Post Pic

How to use jQuery 1.4 by default on your WordPress blog

As you maybe know, the new jQuery version (1.4) is out. But until the next update, your WordPress blog will still use the old jQuery version. This recipe will show you how to easily replace your current jQuery version by the newest 1.4 version.

Simply paste the following code on your 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, '');
   wp_enqueue_script('jquery');
}

Thanks a lot to Sean Hayes for sharing this tip with me!

Also, please note that today I'm lauching a new site called Coupons for Bloggers and as you probably guessed, it is all about discount for all your blogging needs. Great news for WordPress fans, I got a whole lot of WordPress coupons, cush as Headway Theme, Digging into WordPress ebook, Gravity forms, etc...
Happy discount to all of you!

20 Responses

Jan 18 2010 17:35

This tip rocks. Exactly what I need. Thanks for sharing, Jean!

Jan 18 2010 21:12

It’s nice, but why we need the conditional !is_admin()?

Jan 18 2010 21:53

One thing worth noting is that WP’s bundled jQuery is set to jQuery.noConflict() mode. If your site relies on the Prototype library, you’re going to wind up with a clash over the $ variable using the above code.

Jan 18 2010 22:54

Wonderful ! I wil try to use it in mine now :)

Jan 19 2010 05:38

Thankyou.And your new site Coupons for Bloggers is cool

Jan 19 2010 05:41

what the function of jquery?

Jan 19 2010 20:54

As our friend hasbulaqill said,

Some guys doesn’t know what is the function of jquery?,

In fact me too dont know exactly.

When you give these type of tutorials., please give a good explanation.

Thanks for your understanding.. any way keep rocking ;)

Jan 19 2010 21:11

yes..please explain
i doesnt get any answer yet :(

Jan 19 2010 22:32

jQuery makes adding effects to your blog so easy, it requires pretty much 0 effort! Thanks for the tip, I’ll be sure to implement it on Inside the Webb

Jan 19 2010 22:37

This is a good tip, but I would advise plugin authors to take care in utilizing this method. The folks at jQuery worked to ensure backwards compatibility with scripts designed to use jQuery 1.3, but undoubtedly some scripts will fail with the changes made. As Matt Wiebe pointed out, you also have to keep in mind that jQuery in wordpress is often used in noConflict mode, and using jQuery1.4 in the above method might break scripts using mootools, prototype, etc.

My recommendation is to allow users of your plugin to toggle whether or not they want to have jQuery1.4. Perhaps stay with the wordpress-bundled jQuery and have jQuery1.4 as an optional enhancement, and make clear the benefits that 1.4 will provide to people using your plugin.

Mar 08 2010 19:52

Great tip ! Another advantage of this snippet is the external load of the jQuery, that saves bandwidth and help increasing the speed load.

Thank you

Mar 14 2010 06:33

Nice Sharing. Infect i was looking

May 28 2010 16:13

Why not just place direct link to jquery in header.php?

Jun 30 2010 17:52

Very useful, Thanks for sharing.

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required