WordPress Snippet

ワードプレスをカスタマイズしよう

Memo:jQueryの使い方@WordPress

http://core.trac.wordpress.org/ticket/22896#comment:30

With jQuery there is a better way to do this: let the WordPress jQuery load first, then load your desired version in the footer or right before it’s needed, load jQuery UI or any other plugins you want to use with the different version and do:

var myjq= jQuery.noConflict(true);

Ref: ​http://api.jquery.com/jQuery.noConflict/#example-4

Then in your scripts you can use the version you want:

(function($){
// your code here uses the alternative jQuery version
}(myjq));

(function($){
// this uses the standard jQuery version
}(jQuery));

This is the proper way to load several versions of jQuery and have them all work and (of course) doesn’t affect or break anything in WordPress.

[emulsion_relate_posts]