admin管理员组文章数量:1426975
My script and stylesheet files have been failing to load in Chrome IOS, and only Chrome IOS. I changing the value of $ver
in wp_register_script
from a string with a value ("1.0.17") to an empty string, and this caused the problem to clear up. I changed it back, and that caused the problem to happen again, but when I did that process a second time the problem didn't occur, and now I can't reproduce it.
Does anybody know what might be going on with this, and how I can prevent it from happening in the future?
class Queue{
private $cssVer = "1.0.43";
// Chrome breaker?
private $jsVer = "1.0.17";
function __construct() {
$this->suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
$this->add_actions();
}
public function add_actions(){
add_action( 'wp_enqueue_scripts',array( $this, 'queue_all' ),20 );
}
public function queue_all(){
$this->queue_scripts();
$this->queue_styles();
}
private function queue_styles(){
$this->enqueue_all_css();
}
private function queue_scripts(){
$this->enqueue_custom_js();
}
private function enqueue_all_css(){
wp_register_style('style-label',
get_stylesheet_directory_uri().'/folder/filename'.$this->suffix.'.css',
null,
$this->cssVer,
"all"
);
wp_enqueue_style( 'style-label',1 );
}
private function enqueue_custom_js(){
wp_register_script('label-js',
get_stylesheet_directory_uri().'/folder/file'.$this->suffix.'.js',
['jquery'],
$this->jsVer,
false
);
wp_enqueue_script( 'label-js' );
}
}
}
本文标签: wp enqueue styleScripts and stylesheets failing to load in Chrome IOS (and only Chrome IOS)
版权声明:本文标题:wp enqueue style - Scripts and stylesheets failing to load in Chrome IOS (and only Chrome IOS) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745467732a2659604.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论