解决方案 这个问题其实非常简单。我发现很难找到一个好的资源来解决这个问题,所以我在这里回答。
style.css 缺失了:模板:主题在注释头中,即:
/*
Theme Name: samirTheme
Theme URI: http://example.com/twenty-fifteen-child/
Description: Twenty Fifteen Child Theme
Author: John Doe
Author URI: http://example.com
Template: twentyfifteen <--------------------------------------------
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-fifteen-child
*/
/*
Theme Name: Twenty Seventeen
Theme URI: https://wordpress.org/themes/twentyseventeen/
Author: the WordPress team
Author URI: https://wordpress.org/
Description: Twenty Seventeen brings your site to life with immersive featured images and subtle animations. With a focus on business sites, it features multiple sections on the front page as well as widgets, navigation and social menus, a logo, and more. Personalize its asymmetrical grid with a custom color scheme and showcase your multimedia content with post formats. Our default theme for 2017 works great in many languages, for any abilities, and on any device.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: twentyseventeen
Tags: one-column, two-columns, right-sidebar, flexible-header, accessibility-ready, custom-colors, custom-header, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, post-formats, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/
我也遇到了同样的问题。我有所有必要的文件(只需要索引和样式两个文件),但我注意到如果你为你的style.css文件创建了一个文件夹,你会收到上述错误消息。
所以我进行了交叉检查,甚至将index文件从主文件夹中移动并删除了它。
如果我从主文件夹中删除index.php文件,并将其放置在css文件夹中,它就可以工作了。
我不知道为什么会发生这种情况。但是似乎需要在style文件夹内放置一个索引文件或style.css文件放置在主文件夹中。
这个错误也可能是由字符编码引起的。例如:
$ file -I style.css
style.css: text/plain; charset=us-ascii
$ file -I style-error.css
style-error.css: text/plain; charset=utf-16le
从网页(例如教程文章)复制和粘贴CSS代码到CSS文件本身中是导致出现问题的常见原因。如果CSS代码包含特殊字符,有时文件编辑器会尝试更改CSS文件的字符编码以适应添加的所有字符。
虽然这个问题已经过去很久了,但希望这能帮助其他寻找答案的人。