Tagged: x
- 
AuthorPosts
- 
March 10, 2017 at 3:38 pm #1402357 LTWWordpressParticipant LTWWordpressParticipantHello! Our website has a whopping 0% grade on GTMetrix for “Defer parsing of Javascript,” and that “2.9MiB of JavaScript is parsed during initial page load.” According to https://varvy.com/pagespeed/defer-loading-javascript.html, I should add this code right before the </body> tag: <script type="text/javascript"> function downloadJSAtOnload() { var element = document.createElement("script"); element.src = "defer.js"; document.body.appendChild(element); } if (window.addEventListener) window.addEventListener("load", downloadJSAtOnload, false); else if (window.attachEvent) window.attachEvent("onload", downloadJSAtOnload); else window.onload = downloadJSAtOnload; </script>My only issue is that I can’t figure out how to get to the HTML right before </body> to then be able to add this coding! If you guys can help me out, I’d be very appreciative. March 10, 2017 at 3:41 pm #1402364 LTWWordpressParticipantThis reply has been marked as private.March 11, 2017 at 12:56 am #1402793 LTWWordpressParticipantThis reply has been marked as private.March 11, 2017 at 12:56 am #1402793 RadModerator RadModeratorHi there, Thanks for writing in. Please add this code to your child theme’s functions.php add_action('wp_footer', 'before_closing_body', 9999999); function before_closing_body() { ?> <script type="text/javascript"> function downloadJSAtOnload() { var element = document.createElement("script"); element.src = "defer.js"; document.body.appendChild(element); } if (window.addEventListener) window.addEventListener("load", downloadJSAtOnload, false); else if (window.attachEvent) window.attachEvent("onload", downloadJSAtOnload); else window.onload = downloadJSAtOnload; </script> <?php }Hope this helps. 
- 
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1402357 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
