【发布时间】:2016-12-16 21:12:06
【问题描述】:
我在 WordPress 中设置了一个 child theme 并将 /style.css 和 /inc/css/bootstrap.min.css 加入队列,因为这是我从父主题修改的 2 个样式表:
function my_theme_styles() {
wp_enqueue_style( 'child', get_stylesheet_directory_uri() . '/style.css', array(), '1.0' );
wp_enqueue_style( 'child-bootstrap', get_stylesheet_directory_uri() . '/inc/css/bootstrap.min.css', array(), '1.0' );
}
add_action( 'wp_enqueue_scripts', 'my_theme_styles', 99 );
看起来,当我将修改放入 bootstrap.min.css 文件时,它仍然从父 bootstrap.min.css 加载数据。
我尝试将 !important 添加到末尾,甚至将 CSS 添加到 footer.php 文件中以查看是否会覆盖它,但无济于事。
任何建议将不胜感激。
谢谢
已解决:我有点像木偶。在子 bootstrap.min.css 文件中,我将 background-color: none 放在元素上,而在父 bootstrap.min.css 中它具有背景颜色。我必须把透明而不是没有。
【问题讨论】:
-
我以前也遇到过这样的问题,而且大部分时间它与您的机器或服务器中的缓存有关,您是否尝试过清除所有可能的缓存并验证您的更改是否显示?你可以阅读更多关于它here
-
@ArmandoBracho 感谢您的回复。我刚刚清除了浏览器缓存,刷新了,还是没有乐趣。
标签: php css wordpress twitter-bootstrap