Sunday, April 27, 2014

Wordpress: Using the lates jQuery from Google Hosted Libraries

Just put this code into your theme's functions.php file. As new version come out, change the version number too.

 //Making jQuery Google API  
 function modify_jquery() {  
      if (!is_admin()) {  
           // comment out the next two lines to load the local copy of jQuery  
           wp_deregister_script('jquery');  
           wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js', false, '1.8.1');  
           wp_enqueue_script('jquery');  
      }  
 }  
 add_action('init', 'modify_jquery');