KrisChase.com

How to load jQuery in WordPress theme

Posted in Web Development on 06.10.2015 by @chasebadkids

When building out a custom theme, one of the first things most developers will need in their set of tools and resources to write efficient code will be jQuery.  There are a number of ways you can add jQuery into your theme, but there is only one right way.

You might be tempted to download jQuery, upload it to your server and link to it directly in your header, but that isn’t the right way.

What you should do is utilize WordPress’s built in enqueue script functionality to load jQuery at the right time, the right way.

Put the following code in your themes functions.php file

 

Menu