load jquery to wordpress site

Loading a jQuery snippet to your WordPress site shouldn’t be difficult and I noticed online that this type of tutorial didn’t exist – maybe I’m just terrible at Google.

This mini-tutorial will allow you to post JS or CSS to your WordPress website, the principle will stay the same. This type of method to adding JS/CSS to a site should be used for smaller snippets and I do recommend using external JS files and enqueuing the correct way for WordPress.

For this use-case we will be loading a simple JS snippet to the footer of our website so that it doesn’t render block our site and since we only need the JS once the page is completely loaded it’s ideal to load it within wp_footer. For scripts that you want to load in the head tag of your site you may use the wp_head hook.

Here is the general code template –

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.