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' );
}
}
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745467732a4628988.html
评论列表(0条)