我安装了一个 Wordpress 插件,该插件在破坏我的布局的最大宽度值上使用 !important。我已经尝试过使用自己的 CSS 覆盖它的各种方法,但是我无法使用高特异性的选择器,因为该插件已经在使用它。我和开发团队谈过这件事,他们说这是因为插件的样式表在我的之前加载。有没有办法让我先加载?
这就是我在函数文件夹中排队我的样式表的方式 -
如您所见,我已将其分为第一部分 (if) 中的自定义页面模板和第二部分 (else) 中的主样式表。
有没有办法让主样式表优先于我安装的插件?
if (is_page_template('page-templates/full-page.php')) {
wp_enqueue_style( 'mytheme', get_stylesheet_uri() );
wp_enqueue_style( 'mytheme-full-page', get_stylesheet_directory_uri() . '/css/full-page.css', array( 'mytheme_style' ) );
}
else { wp_enqueue_style( 'mytheme_style', get_stylesheet_uri() );
}
}
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles_and_scripts' );
您可以优先考虑add_action( 'wp_enqueue_scripts', 'enqueue_my_styles_and_scripts' );
在最后尝试添加值的函数:
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles_and_scripts', 99 );
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句