2013-07-01 45 views
0

我目前正在開發一個WordPress插件。我排隊以下,並註冊他們:wordpress插件開發 - 排隊腳本

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'); 

奧尼我的一個開發網站,這工作正常。當我來到別人安裝它,我得到在Firebug的控制檯以下錯誤:

TypeError: $(...).tooltip is not a function 

做任何事情似乎超出此地方?

回答

1

請勿替換隨WordPress附帶的捆綁jQuery,currently in version 1.8.3。核心版本以noConflict模式加載,而Google CDN版本則不是。可能,在代碼正在工作的開發設置中出現問題

除了這個問題,也許你可以添加的jQuery作爲依賴於tooltip_options

wp_register_script(
    'tooltip_options', 
    plugins_url('js/tooltip_options.js', __FILE__), 
    array('jquery'), // <--- Dependencies 
    NULL, 
    true 
); 

相關Q & A的在WordPress的答案: