This topic has 5 replies, 2 voices, and was last updated 5 years, 2 months ago ago by Olga Barlow
Hello, I’ve a problem with all my websites where I’m using your beautiful theme.
If I test the website with the GTmetrix tool, the result is always that I need to “Defer parsing of JavaScript”.
To do it I have two possibilities:
1) install and active “Async JavaScript” plugin
or
2) insert this code in function.php
function defer_parsing_of_js ( $url ) {
if ( FALSE === strpos( $url, '.js' ) ) return $url;
if ( strpos( $url, 'jquery.js' ) ) return $url;
return "$url' defer ";
}
add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
Well, whatever process I use, I solve the problem (as you can see by the links in PVT). However, with both methods, there is a problem: the buttons on the Portfolio page stop working.
How to solve the problem? Maybe could I exclude the Portfolio page only in some way?
Hello,
You may try cache plugin and JS minification+combination in one and after that try to defer them.
Let me know if it does not work for you.
Regards
P.S. clean_url function is deprecated https://developer.wordpress.org/reference/functions/clean_url/
Regards
Hello,
How to “try cache plugin and JS minification+combination in one” and after how to “defer them”.
What plugin (or code) do you suggest to use in both cases?
I’m not sure to have understood how to do it.
Hello,
Use cache plugin for these purposes: W3 Total cache, WPRocket or any other that includes these options, for example, http://prntscr.com/p7oikg
Regards
You must be logged in to reply to this topic.Log in/Sign up