Replace jQuery of WordPress with Google AJAX Library


Sponsored Links




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.

Replace jQuery of WordPress - Shakira Cleverage Photo

Replace jQuery of WordPress - Shakira Cleverage Photo

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

On this example, we use wp_enqueue_script() to do this tricks, thanks for WP Engineer to share it, now you can Replace jQuery of WordPress with Google AJAX Library more easier right?

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net

Replace default WordPress jQuery script with Google Library

Easy tutorial that lets you replace the default WordPress jquery script with Google Library code above, don't forget to replace the jquery URl by this one : http://ajax Read More

jQuery: The Write Less, Do More, JavaScript Library

jQuery is a new kind of JavaScript Library. jQuery is a fast traversing, event handling, animating, and Ajax Who's using jQuery? Google; Dell; Bank of America; Major League Read More

Small Tips Using WordPress and jQuery - WP Engineer

after_setup_theme since WordPress 3.0; Replace jQuery of WordPress in your Theme with Google AJAX Library. In the following code the jQuery-Library of Google CDN gets loaded Read More

5 Tips For Using jQuery with WordPress / Eric Martin / ericmmartin.com

You can replace my_init with something more meaningful, but Load jQuery from the Google AJAX Library. Since WordPress includes jQuery, calling wp_enqueue_script('jquery Read More

What Is the Difference Between Google jQuery & WordPress jQuery

Between Google jQuery & WordPress jQuery to reference the jQuery library file because WordPress in mind that WordPress uses jQuery in compatibility mode, so replace Read More


6 Responses to Replace jQuery of WordPress with Google AJAX Library

  1. Pingback: wp-popular.com » Blog Archive » Replace jQuery of WordPress with Google AJAX Library # WordPress Tricks & Tips

  2. Pingback: WordPress jQuery durch die Google AJAX Library ersetzen

  3. Pingback: WordPress Themehacks » WordPress jQuery durch Google AJAX Library ersetzen

  4. Ma'moun says:

    Why do you think we should do this? Is it any better?

  5. Pingback: The Creative Solution to Insert Google Analytics on WordPress | WordPress News Wire

  6. Natan says:

    You can also use the same trick to remove the need for jquery in the embed script when embedding surveys into wordpress using Rational Survey.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>