这是造成问题的原因,因为我以前没有这样做过。我试图排队的风格或可能是脚本取决于页面。但它不起作用。代码如下:
add_action(\'init\', \'my_enqueue_styles\');
function my_enqueue_styles(){
if(is_page(\'Add Event\')){ // also tried slug, page id and wp_reset_query(); bot not worked
wp_deregister_style( \'jquery-ui-custom-flick\' );
wp_register_style( \'jquery-ui-custom-flick\', get_bloginfo(\'template_directory\') .\'/styles/jquery.ui/ui.custom.flick.css\');
wp_enqueue_style( \'jquery-ui-custom-flick\' );
}
}
我没有做有条件的权利。脚本在没有条件的情况下工作。谢谢
RESOLVED:
问题在于init
行动挂钩。有条件的is_page()
当init
被调用。将样式添加到挂钩后wp_print_styles
它工作得很好。