Javascript Jquery Above the fold

Hey there, long time lurker first time forum poster ! Hope I am in the right place. trying to Eliminate render-blocking JavaScript and CSS in above-the-fold content

Could use a little help been having some trouble with some Javascript trying to get Jquery.js to not load above the fold,
been trying to wrap the rd_script function inside a document.ready() function but seem to be missing something.

So lets say It is a wordpress theme, and the call to the Jquery.js is inside a functions.php , so a little tough to move it as it breaks the site, my coding could use a little work but I have tried numerous solutions but to no avail any advice or help would be appreciated

Website in reference is here Web Boutique if anybody wants to take a look, a basic e-commerce retail webs store working on page load speeds and asyn

This should work,it de-registers the jquery and another then re-registers in footer (as it’s registered in the header by default)

function change_jquery_placement() {
    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', includes_url( '/js/jquery/jquery.js' ), false, NULL, true );
    wp_enqueue_script( 'jquery' );
add_action( 'wp_enqueue_scripts', 'change_jquery_placement' );

add to your functions.php at the bottom before any ?>

You may find it causes some other errors including jquery migrate and any plugins that add scripts to the header so you may need to add more to this function, personally I wouldn’t bother as it’s likely to cause issues but if you’re determined, you can do this with a little bit of work :slight_smile:

Simply put this code in your .htaccess file


ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType application/javascript "access 1 month" ExpiresByType application/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access 2 days" ## EXPIRES HEADER CACHING ##

Source :