Tagged: x
-
AuthorPosts
-
September 16, 2016 at 9:23 pm #1178960
Hello,
I´m totally stuck trying defer parsing javascript. I need the correct code to put at the end of the functions.php file of the child theme. Nothing I managed to find worked. My website is http://xn--b1aedymdw6j.com/
September 17, 2016 at 2:28 am #1179146Hello There,
Thanks for writing in! Please use a 3rd party plugin like Minify to handle this things. For more details about how you can speed your site, please check out our knowledge base here: https://community.theme.co/kb/performance/
Hope this helps.
September 17, 2016 at 5:36 am #1179251Hello,
I installed minify and I have no idea how to use it. It askes for Cache-buster value, what is this? I also downloaded gzip and my site crashed it took for ever to get back up. I found some snipets of code online to add to the functions.php file I tried all of these methods they almost worked; http://www.laplacef.com/2014/05/24/how-to-defer-parsing-javascript-in-wordpress/ exept the last one.
This one almost works except the header links get screwed up for acouple seconds;
defer parsing of javascript – PS2if(!is_admin()) {
// Move all JS from header to footer
remove_action(‘wp_head’, ‘wp_print_scripts’);
remove_action(‘wp_head’, ‘wp_print_head_scripts’, 9);
remove_action(‘wp_head’, ‘wp_enqueue_scripts’, 1);
add_action(‘wp_footer’, ‘wp_print_scripts’, 5);
add_action(‘wp_footer’, ‘wp_enqueue_scripts’, 5);
add_action(‘wp_footer’, ‘wp_print_head_scripts’, 5);
}I was hoping you could provide me with the correct code for the functions.php.
This code is from the link <script type=”text/javascript” defer=”defer” src=”YOUR_SOURCE_HERE”></script>
what should I put for the YOUR_SOURCE_HERE?September 17, 2016 at 5:47 am #1179255After activating minify the site crashed again! I didnt put any Cache-buster value. It gives an error message of:
Fatal error: Maximum execution time of 30 seconds exceeded in /home2/silver21/public_html/xn--b1aedymdw6j.com/wp-content/plugins/minify/CSSMin.php on line 3231September 17, 2016 at 6:00 am #1179258Hi there,
Please connect to FTP and add
php_value max_execution_time 60
to .htaccess file.
For more information, check this link : https://codex.wordpress.org/Common_WordPress_Errors#Maximum_execution_time_exceededHope it helps.
September 21, 2016 at 10:43 am #1184838So, What do I write for the minify Cache-buster value. So what about the code that I could add to the functions.php file to make the site load faster. Have you got any ideas?
September 21, 2016 at 11:20 am #1184900All these pugins I´ve used have just made more problems. I just installed w3 total cache and my site went crazy. So What are my options besides installing third party software. I think the solution is in getting the correct code for the functions.php file.
September 21, 2016 at 2:36 pm #1185286Hi there,
I see JS error in your site console, please try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.
Let us know how it goes.
October 2, 2016 at 3:16 pm #1199592Hi,
I´m totally lost with this issue. I have tried everything possible and I am not able to fix the problem with the speed. I deactivated all plugins except cornerstone and essential grid. The site is still super slow. I also removed all the custom css, that did not work either. Minify does not help either. I have to get this site ready, my client is about to loose it ! I think the problem is with the Defer Parsing Javascript but I have no idea how to fix it. Please help solve this problem, I´ve spent far too much time on this.Is it possible that I could give you access to the ftp and you could get it fixed?
Thanks in advance.
October 2, 2016 at 8:20 pm #1199878Hello There,
To assist you better with this issue, would you mind providing us the url of your site with login credentials so we can take a closer look? This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / passwordDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
Thank you.
October 2, 2016 at 8:35 pm #1199885This reply has been marked as private.October 3, 2016 at 12:03 am #1200064Hi there,
Yes, your site is too slow, are you on shared hosting?
What I understand is “defer” setup will only enhance the loading of the items on visitors browser, it will not enhance the performance of your site within your server. The problem that I can see from your site is internal performance and it’s randomly slow.
How about contacting W3 total cache’s author? Optimization plugins still require proper configuration depending on the site. That plugin has the defer setup through minified files. That’s because Theme and plugins are from different author and they have their own implementations.
Example, let’s say you successfully implemented the code for X theme’s “defer” setup then you’ll do the same for the cornerstone. Then you should do the same for other 3rd party plugins too in which we can’t really help (editing and analysing their files). There is no universal solution because it varies, and the code is given here http://www.laplacef.com/2014/05/24/how-to-defer-parsing-javascript-in-wordpress/ is just a general knowledge of how it can be done.
Another sample is this http://matthewhorne.me/defer-async-wordpress-scripts/, and you still need to find out the correct handle used by themes and plugins. You can use this one, but this only covers X theme and Cornerstone.
add_filter('script_loader_tag', 'implement_defer', 10, 2); function implement_defer($tag, $handle) { $x_handles = array ( 'x-site-head', 'x-site-body', 'x-site-icon', 'cs-google-maps', 'cornerstone-site-head', 'cornerstone-site-body', 'vendor-ilightbox'); if ( !in_array( $handle, $x_handles) ) return $tag; return str_replace( ' src', ' defer="defer" src', $tag ); }
I didn’t include the handles for loaded javascripts on admin and builder, it’s because the visitors, google, and other analysis tools will not reach them. This doesn’t guarantee that your site’s functionality will work 100%, that’s why it’s best to apply “defer” on minified files because they are combined into the single file in the correct order ( no problem with the dependency between libraries ).
Thanks!
-
AuthorPosts