如何使用wp_enqueue_script在wordpress中加载jquery对话框?

如何在加载页面后加载jquery对话框? 我的意思是我不想每次刷新页面时加载它。

我知道这与cookie有关。

这是我的对话

var $j = jQuery.noConflict(); $j(function(){ $j(document).ready(function(){ $j('#west').dialog({show: 'slow', modal: true, height: 600, width: 850, title: 'Price Comparison Popup', resizable: false, draggable: false}); }); }); 

我不确定我是否完全理解您的问题,但如果您只想在代码中添加jquery-ui脚本,请使用以下内容:

 //assuming you are working on a plugin $plugin_url = plugins_url('myPlugin'); //register and enqueue the script wp_register_script("jquery-dialog", $plugin_url . '/js/jquery.dialog.js', 'jquery'); wp_enqueue_style('jquery-dialog'); 

这将包括脚本,并确保它在Wordpress的jQuery版本之后加载。