Reputation: 5846
I am currently developing a WordPress plugin. I enqueue the following and also register them:
wp_register_script('woo_checkout_tooltips_jquery_js', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
wp_register_script('woo_bootstrap_js', 'http://twitter.github.com/bootstrap/assets/js/bootstrap-tooltip.js');
wp_register_style('woo_checkout_tooltips_css', plugins_url('css/bootstrap.css', __FILE__) );
wp_register_style('woo_bootstrap_css', plugins_url('css/style.css', __FILE__) );
wp_enqueue_style('woo_bootstrap_css');
wp_enqueue_style('woo_checkout_tooltips_css');
wp_enqueue_script('woo_checkout_tooltips_jquery_js');
wp_enqueue_script('woo_bootstrap_js');
wp_register_script('tooltip_options',plugins_url('js/tooltip_options.js', __FILE__),array(),NULL,true);
wp_enqueue_script('tooltip_options');
Ony one of my development sites this works fine. When i come to install it on others i get the following error in the console of firebug:
TypeError: $(...).tooltip is not a function
Does anything seem out of place above?
Upvotes: 0
Views: 317
Reputation: 26055
Do not replace the bundled jQuery shipped with WordPress, currently in version 1.8.3. The core version is loaded in noConflict
mode, and Google CDN version is not. Probably, there's something wrong with the dev setup where this code is working.
Apart from this issue, maybe you could add jQuery as dependency for tooltip_options
:
wp_register_script(
'tooltip_options',
plugins_url('js/tooltip_options.js', __FILE__),
array('jquery'), // <--- Dependencies
NULL,
true
);
Relevant Q&A's at WordPress Answers:
Upvotes: 1