Using multiple versions of jQuery while still calling it like WP likes
-
I have two JS plugins inside my plugin. One uses jQuery 1.7.1 and the other 1.9.1.
I need to have each of them use different version? This is how things are at the moment:
Plugin php file:
wp_register_script('jq-1.9.1-js', 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'); wp_enqueue_script('jq-1.9.1-js'); wp_register_script('jq-1.7.1-js', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'); wp_enqueue_script('jq-1.7.1-js');
Plugin JS file:
var $j = jQuery.noConflict(); $j(document).ready(function() { // plugin 1 $j('.someClass').plugin1({ // options }); // plugin 2 $j('.someClass').plugin2({ // options }); }
I searched google quite a lot and saw solutions for multiple versions but they did not take into account the proper way of including scripts in WP (the use of register and enqueue).
Thanks
- The topic ‘Using multiple versions of jQuery while still calling it like WP likes’ is closed to new replies.