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).
How do I use two versions of jQuery for two JS plugins while still calling scripts the WP way?
Thanks