Reply To: Defer loading of javascript

Home Forums Main Forum Theme Suggestion Box Defer loading of javascript Reply To: Defer loading of javascript

Sushil Adhikari

Hi there,

Thanks for illustrating issue on details. All our .js are loaded on footer area which means js are loaded after the page loads. You can see the screenshot attached.

And there is some text that are loaded outside the footer area. It also includes js from google analytics plugin. There is some js on theme that are loaded ourside the footer area. To load them on footer you can use this concept.

wp_enqueue_script( 'puresimple-jquery-ui', get_template_directory_uri() . '/js/jquery-ui.js', array( 'jquery' )); 

In the above code if add argument true at last it will load that particular js on footer for an example:

wp_enqueue_script( 'puresimple-jquery-ui', get_template_directory_uri() . '/js/jquery-ui.js', array( 'jquery' ), true);

Note: Please follow the process only if you are technically sound on WordP1ress.


You must be logged in to view attached files.