Post Pic

How to include JQuery on your WordPress theme

JQuery is definitely a great Javascript framework, which allow you to, among other things, create stunning visual effects. Including JQuery is easy. But do you know that WordPress can make it even easier?

The first thing you have to know is that WordPress already have JQuery (It is used in the dashboard) so you don't need to download a new copy of JQuery to your WordPress server.
Then, we just have to use the wp_enqueue_script() function, which automatically enqueue a Javascript file in your theme header.
Open your header.php file and paste the following within the <head> and </head> tags:

<?php wp_enqueue_script("jquery"); ?>

By the way, Cristian just wrote a very interesting post at Cats Who Code. It is all about WordPress Theme Frameworks so be sure to check it out!

Thanks to Chris Coyier for the tip!

Related Posts

Related Posts

No related posts.

3 Responses

Jun 07 2012 21:56

before or after wp_head ?

Jul 06 2012 08:02

Before wp_head.

Mar 01 2013 21:38

Should before wp_head.

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required

WP Theme of the week

Sponsored Likebox