admin管理员组文章数量:1289529
I renamed style.css
to my-style.css
, but now I am getting an error in WordPress:
"The requested theme does not exist. Stylesheet is missing."
I know the reason for that error, but how can I solve that without changing the stylesheet name again?
I renamed style.css
to my-style.css
, but now I am getting an error in WordPress:
"The requested theme does not exist. Stylesheet is missing."
I know the reason for that error, but how can I solve that without changing the stylesheet name again?
Share Improve this question edited Jul 9, 2021 at 8:59 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Jul 9, 2021 at 6:56 user208353user2083532 Answers
Reset to default 1Your theme must contain a style.css file, and it needs to have a comment at the top with the theme details.
https://developer.wordpress/themes/basics/main-stylesheet-style-css/
You can not delete style.css and have a functioning theme (at least without hacking WordPress core files). All the theme meta information is written in the style specifically. You can, however register another css file named my-style.css
or whatever the name you want.
function my_theme_css() {
wp_enqueue_style( 'my-style', get_template_directory() . '/my-style.css' );
}
add_action( 'wp_enqueue_scripts', 'my_theme_css' );
Now, your style.css does not have any css so you may want to remove it from your html. You can remove it from your site's <head>
using wp_dequeue_style(). But the physical file has to be there in your theme's directory.
add_action('init','_remove_style');
function _remove_style(){
wp_dequeue_style('style.css');
}
本文标签:
版权声明:本文标题:The requested theme does not exist. Stylesheet is missing - error after changing style.css name to my-styles.css in wp child the 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741454094a2379656.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论