• 0

Loading JS at the end of the page


Question

Posted · Report post

Hi

 

I have a slowness problem in one of my websites (http://heseg.com), and I am trying to better the speed.

I am using a child theme with costume sections and I am importing those assets in the function section_head() method.

Is there a way to move the JS imports to the bottom of the page to prevent a delay in the page upload?

 

Thanks

Shani

Share this post


Link to post
Share on other sites

3 answers to this question

  • 0

Posted · Report post

Thanks

 

Is that Pagelines limit or WP limit?

And can you point me how can I improve this issue as I am using many scripts in my website?

 

Thanks

Shani

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

To include JS file use the section_scripts() functions.

 

e.g.:

function section_scripts() {
   wp_enqueue_script( 'masonry_js', $this->base_url.'/jquery.masonry.min.js', array('jquery'), '2.1.05', true );
}

Note the last 'true' parameter, this is to include the JS in the footer

http://codex.wordpress.org/Function_Reference/wp_enqueue_script

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now