Open fantastlcok opened 7 years ago
你首先
wp_register_script( 'jquery', '//staticfile.qnssl.com/jquery/2.2.1/jquery.min.js');
注册了jquery,然后
wp_deregister_script( 'jquery' );
注销了jquery,
所以我测试是后面几个wp_enqueue_script
,前两个可以执行,而第三个因为执行被注销的jquery,其报错,同样导致后面第四个执行被取消
@thundernet8 我只添加代码
function myxxxCss() {
wp_register_style( 'xxx', '/wp-content/themes/Tint/assets/css/xx-vb45h7y95h.css', false, false, true );
if ( !is_admin() ) {
wp_enqueue_style( 'xxx' );
}
}
add_action( 'init', 'myxxxCss' );
毫无疑问,css确实加载了。 http://ww1.sinaimg.cn/large/ec76730dgy1fctujknolbj206w040jrd.jpg 但是样式并没有效果。 然后开启主题缓存,在第一次访问页面插件正常加载了文件后,第二次访问插件就无法加载文件了。我开启主题的禁用缓存可以解决这个问题。
使用某短代码插件,此插件需要加载自己的css和js。 在文章内使用短代码后,第一次打开文章页面正常显示。第二次打开,页面没有加载短代码css、js。 清理主题缓存后再打开页面,正常显示。再次打开,页面没有加载短代码资源。
我尝试自己在页面内引入代码,但似乎引入的代码没有任何效果。我确保引入的代码确实被加载了。
http://ww1.sinaimg.cn/large/ec76730dgy1fcsdh5xqisj208f0anaag.jpg 例如其中xxx.css内有样式
但根本没有任何效果,如果我手动直接在页脚载入则没有任何问题。