我在wordpress中使用jquery ui dialog
製作對話框。我遇到的問題是當對話框出現時,關閉按鈕'X'
未顯示。示例如下。在jQuery UI中顯示'關閉'按鈕 - 帶有WP的對話框
我必須做出對這個問題的一些閱讀,這是由於對bootstrap
衝突。 Reference on Stackoverflow.我如何在wordpress上實現它?下面是我對functions.php
代碼,我把
function add_my_script() {
if(is_page('my_custom_page')){
//Tried to deregister bootsrap and it work fine but I need the boostrap as well.
//wp_deregister_script('zerif_bootstrap_script');
//Tried to degregister and enqueue back the script to follow the rules base on reference
//wp_enqueue_script('zerif_bootstrap_script', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '20120206', true);
wp_enqueue_script('jquery-ui-dialog');
}
}
add_action('wp_enqueue_scripts', 'add_my_script');
更新解決方案:
目前,我在我的主題使用Zerif精簡版,它是在function.php
。
wp_enqueue_script('zerif_bootstrap_script', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '20120206', false);
默認值是true
,這將是發生在頁腳。我將該值更改爲false,以便將它放在標題中,就像我的jquery-ui腳本一樣。
你好Amran,'jQuery'使用圖標圖片,應該會丟失。 – BlueSuiter