I will show you little code How To Replace jQuery of WordPress in your Theme with Google AJAX Library, like we all know, WordPress has built in a lot of JavaScript Framework included jQuery, but for some reason such as Sever Speed or better handling, we need replace original jQuery for WordPress and using Google AJAX Library.
To use this featured is simple, we need put some code in our functions.php and your WordPress will use Google AJAX Library. Let’s get started
function jQuery_Google_init() {
if ( !is_admin() ) { // actually not necessary, because the Hook only get used in the Theme
wp_deregister_script( 'jquery' ); // unregistered key jQuery
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', false, '1.4.2'); // register key jQuery with URL of Google CDN
wp_enqueue_script( 'jquery' ); // include jQuery
}
}
// For Themes since WordPress 3.0
add_action( 'after_setup_theme', 'jQuery_Google_init' ); // Theme active, include function


