admin管理员组文章数量:1125591
I'm writing style codes for a WordPress theme. But the theme reads the style codes from the style.min.css file. I just want it to read from the style.css file. How can I disable it from reading from this compressed css file?
I'm writing style codes for a WordPress theme. But the theme reads the style codes from the style.min.css file. I just want it to read from the style.css file. How can I disable it from reading from this compressed css file?
Share Improve this question asked Feb 22, 2024 at 5:13 A. MullerA. Muller 518 bronze badges 1- 1 What style.min.css file? Is it coming from WordPress or a theme? If it's from WordPress you're probably referring to the block styles. These are required for content created with the block editor to appear correctly on the front end. If you stop it from loading you're just going to need to rewrite it all anyway. – Jacob Peattie Commented Feb 22, 2024 at 7:27
2 Answers
Reset to default 0you can be used enqueueing your own CSS file and deregister the default stylesheet using Wp default hook
Replace default-theme-style
with to register name mentioned in the minified CSS style link.
Add code in functions.php
file
Deregister for style.min.css
function deregister_default_stylesheet() {
// Deregister the default stylesheet
wp_deregister_style( 'default-theme-style' );
}
add_action( 'wp_enqueue_scripts', 'deregister_default_stylesheet', 20 );
// Enqueue your own stylesheet `style.css`
function theme_enqueue_styles() {
// Enqueue your own stylesheet
wp_enqueue_style( 'my-css-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
You can enqueue your stylesheet this is how: https://developer.wordpress.org/reference/functions/wp_enqueue_style/
You can dequeue the existing stylesheet this is how: https://developer.wordpress.org/reference/functions/wp_dequeue_style/
本文标签: themesHow to cancel stylemincss file
版权声明:本文标题:themes - How to cancel style.min.css file? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736642281a1946023.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论