【发布时间】:2017-05-09 04:41:40
【问题描述】:
我正在 wordpress 中使用jquery ui dialog 制作一个对话框。我遇到的问题是当对话框出现时,关闭按钮'X' 没有显示。示例如下。
我已经阅读了有关此问题的一些信息,这是由于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 Lite,它位于 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使用图标图像,它应该丢失了。
标签: php jquery wordpress twitter-bootstrap