入队jquery-ui的正确方法
我在插件中包含jquery-ui脚本和样式时遇到了困难。看来我的wp_enqueue_script电话完全被忽略了。 已经有很多与此问题类似的问题,但是到目前为止,我发现的所有答案都归结为wp_enqueue_script在wp_enqueue_scripts动作挂钩中调用,而这已经在做了。 在类的构造函数中,我调用: add_action( 'wp_enqueue_scripts', array($this, 'enqueue_scripts') ); 然后,在下面: public function enqueue_scripts() { wp_enqueue_script( 'jquery-ui-core', false, array('jquery') ); wp_enqueue_script( 'jquery-ui-widget', false, array('jquery') ); wp_enqueue_script( 'jquery-ui-mouse', false, array('jquery') ); wp_enqueue_script( 'jquery-ui-accordion', false, array('jquery') ); wp_enqueue_script( 'jquery-ui-autocomplete', false, array('jquery')); wp_enqueue_script( 'jquery-ui-slider', false, array('jquery')); 我检查了代码是否实际上在每次页面加载时都会执行。但是,页面缺少<link>jquery-ui库的标签。我已经尝试过jquery在wp_enqueue_script调用的第三个参数中显式指定的依赖性和不依赖性。 我还尝试了简单的WP 4.8安装,除了我的以外没有安装任何插件,并且仅使用默认的27个主题。没有骰子。 我的代码有什么问题?