我正在制作 wordpress 设计并使用 wp_register_style 和 wp_enqueue_style 函数将其包含在内。 function.php 中的代码如下:
function themeSetup (){
wp_register_style( 'prostyle', get_template_directory_uri() .'/common/prostyle.css', array(), null, 'all' );
wp_enqueue_style( 'prostyle' );
wp_register_style( 'style', get_stylesheet_uri(), array(), null, 'all' );
wp_enqueue_style( 'style' );
wp_register_script( 'JqueryCDN', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', '', null, false );
wp_enqueue_script( 'JqueryCDN' );
wp_register_script( 'proscript', get_template_directory_uri() .'/common/proscript.js', '', null, false, false );
wp_enqueue_script( 'proscript' );
}
add_action('wp_enqueue_scripts', 'themeSetup');
主要问题:我之前编写的 css 在网站上运行,但包含在同一文件中的每个新 css 规则既没有显示在浏览器上,也没有应用于元素。
请告诉我这些代码中缺少什么。如果 wp_register_script 或样式函数有任何错误,请告诉我。
最佳答案
第 1 步:对于 chrome,始终使用隐私窗口或隐身模式。
第 2 步:禁用您的缓存插件(如果有)。
第 3 步:在您的样式中附加版本,强制服务器使用较新的版本。
第 4 步:Cloud flare 没有将您的 css 作为较新版本。
关于php - 为什么我的样式表没有应用我新编码的样式,即使它已正确包含在 wordpress 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41075502/