Include jQuery from Google in WordPress

Jquery Logo

by Tiziano on February 21, 2010

in WordPress Optimization

If you want to use jQuery JavaScript library in your WordPress theme, the best choice is to load the version hosted on Google servers instead of the local one shipped by default with WordPress.

To load jQuery from Google you have to edit the functions.php file of your theme adding these lines of code:

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

Comments on this entry are closed.

Previous post:

Next post: