WordPress 无法识别 /themes/ 文件夹中的主题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4149139/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WordPress not recognizing theme in /themes/ folder
提问by Andrew Ryno
Having a really baffling issue with permissions, WordPress and theme files.
在权限、WordPress 和主题文件方面有一个非常令人困惑的问题。
I have a fresh install of WordPress and tried uploading the theme I made for my client. It uploaded fine but it doesn't show up in the Manage Themes menu. I checked everything was uploaded and it was. Checked permissions (even set them to 777 at one point) and they were fine. But the theme doesn't show up.
我全新安装了 WordPress,并尝试上传我为客户制作的主题。它上传得很好,但没有显示在“管理主题”菜单中。我检查了所有内容都已上传,确实如此。检查权限(甚至一度将它们设置为 777),它们很好。但是主题不显示。
Here are the different scenarios I've tried:
以下是我尝试过的不同场景:
- Using the Install Themes menu and uploading a .zip (failed)
- Duplicate twentyten folder and contents (worked)
- Duplicate twentyten folder and used my theme files (failed)
- Duplicate twentyten folder and used my theme files and their style.css (failed)
- Uploaded my theme WITHOUT style.css (gave missing style.css error)
- Uploaded my theme WITHOUT style.css and put in twentyten/created one from scratch (both failed)
- 使用“安装主题”菜单并上传 .zip(失败)
- 复制二十个文件夹和内容(工作)
- 复制二十个文件夹并使用我的主题文件(失败)
- 复制二十个文件夹并使用我的主题文件及其 style.css(失败)
- 上传了我没有 style.css 的主题(给出了缺少 style.css 错误)
- 在没有 style.css 的情况下上传我的主题并从头开始放入二十个/创建一个(都失败了)
I'm on my clients MediaTemple hosting and I've never encountered this error. Their support has yet to get back to us.
我在我的客户 MediaTemple 托管上,我从来没有遇到过这个错误。他们的支持尚未得到我们的回报。
Does anyone have a similar problem? Solution? It's possible I can give you FTP access if needed.
有没有人有类似的问题?解决方案?如果需要,我可以为您提供 FTP 访问权限。
CSS Head (changed values but format and everything is still the same):
CSS Head(更改了值但格式和一切仍然相同):
/*
Theme Name: Example Theme
Theme URI: http://example.com/
Description: WordPress theme
Author: Company
Version: 1.0
*/
Edit: Trying to access the folder through my browser results in a 403 error (works fine on twentyten). style.css can be viewed from the browser.
编辑:尝试通过我的浏览器访问该文件夹会导致 403 错误(在 20 上工作正常)。style.css 可以在浏览器中查看。
回答by Henrique
If you are using a MULTI-SITE installation of Wordpress, you have to first go into Network Admin, select Themes from the left menu and enable the themes you like to use before they can appear on the "Manage Themes" page in the Site Admin section.
如果您使用的是 Wordpress 的多站点安装,您必须首先进入网络管理,从左侧菜单中选择主题并启用您喜欢使用的主题,然后它们才能出现在站点管理的“管理主题”页面上部分。
回答by Craig
Perhaps you are missing a required template file?
也许您缺少所需的模板文件?
At the very minimum, a WordPress Theme consists of two files:
style.css
index.php
一个 WordPress 主题至少包含两个文件:
样式文件
索引.php
回答by Rolf
On Ubuntu 14.04 you can install the wordpress
package simply using sudo apt install wordpress
but then you have to set a link to the themes directory.
在 Ubuntu 14.04 上,您可以wordpress
简单地使用安装包,sudo apt install wordpress
但是您必须设置一个指向主题目录的链接。
E.g. for your "newTheme":
例如,对于您的“新主题”:
ln -s /usr/share/wordpress/wp-content/themes/newTheme /var/lib/wordpress/wp-content/themes
ln -s /usr/share/wordpress/wp-content/themes/newTheme /var/lib/wordpress/wp-content/themes
回答by weed
I bet you have some special characters in your templates. This once drove me nuts to find. Check your Template files and/or rename them until the theme shows up. I used a german "?" in a templates name.
我敢打赌,您的模板中有一些特殊字符。这曾经让我发疯地寻找。检查您的模板文件和/或重命名它们,直到主题出现。我用了德语“?” 在模板名称中。
回答by drazewski
I had a very similar problem. Spent a few hours before I found that somehow when I moved my local site (probably using All-in-one Wp Migration plugin), a .htaccess file was created in the /wp-content folder. I don't remember what was inside this file but I think it didn't matter. After removing this file everything was ok.
我有一个非常相似的问题。花了几个小时才发现,当我移动本地站点(可能使用一体化 Wp 迁移插件)时,在 /wp-content 文件夹中创建了一个 .htaccess 文件。我不记得这个文件里面有什么,但我认为这无关紧要。删除此文件后一切正常。
回答by Jean-Marc Liotier
As I discovered at the end of tortuous troubleshooting, an old wp-config.php may cause newly installed themes to be undetectedand invisible in /wp-admin/themes.php - I am not sure that you have the exact same problem but it looks very similar to mine and you might want to try your configuration with a wp-config.php newly generated by Wordpress.
正如我在曲折的故障排除结束时发现的那样,旧的 wp-config.php 可能会导致新安装的主题在 /wp-admin/themes.php 中无法检测和不可见 - 我不确定您是否有完全相同的问题,但它看起来与我的非常相似,您可能想尝试使用 Wordpress 新生成的 wp-config.php 进行配置。
回答by kevinji
I am guessing BOMs are the problem. They messed up my validation of a page once, as I tried to remove the BOM. Try using an editor and remove the BOMs. For Notepad++, the text editor I use, I just set the encoding to UTF-8 without BOM and saved. That solved my problem. Of course, your text editor may be different.
我猜BOM是问题所在。当我试图删除 BOM 时,他们曾经搞砸了我对页面的验证。尝试使用编辑器并删除 BOM。对于Notepad++,我使用的文本编辑器,我只是将编码设置为没有 BOM 的 UTF-8 并保存。那解决了我的问题。当然,您的文本编辑器可能会有所不同。
回答by Mike Wills
Is the theme folder name different than everything else? Is the Theme Name in style.css different than everything else?
主题文件夹名称与其他所有名称不同吗?style.css 中的主题名称是否与其他所有内容不同?
回答by Meetai.com
- Make a backup of your styles.css
- Copy the
styles.css
file fromtwentyforteen
to your theme folder. - Only change the template name at the top of the file
- Re-load the themes page in WordPress admin; once you've seen it working,
- Further-modify the new
styles.css
file as needed.
- 备份你的styles.css
- 将
styles.css
文件复制twentyforteen
到您的主题文件夹。 - 只更改文件顶部的模板名称
- 在 WordPress 管理中重新加载主题页面;一旦你看到它工作,
styles.css
根据需要进一步修改新文件。
回答by Bálint Budav?lgyi
The problem could have been, that you uploaded it in .zip
问题可能是,您将其上传到 .zip