How To Include jQuery in WordPress Theme

Posted: May 13, 2011 in jQuery, Wordpress
Tags: ,

The following is the best way to go about it. Add the following to the theme’s functions.php file:

if( !is_admin()){
   wp_deregister_script('jquery');
   wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), false, '1.3.2');
   wp_enqueue_script('jquery');
}

Replace the URL with the location of what version of jQuery you want to use. The URL above (at the time of this writing) links to the latest version of jQuery on Google’s servers (v1.4) and has in the past linked to v1.3.2. Theoretically I would think it will continue to be the most latest version, until jQuery goes 2.0.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s