WordPress 主题 css 文件

发布于 2024-10-28 03:29:58 字数 197 浏览 4 评论 0原文

根据Wordpress的文档,当我们创建主题时,我们需要在与header.php、footer.php等其他文件相同的位置创建style.css文件,但是,为了更好地组织文件,我将所有css文件放在一起在子文件夹中。

那么问题来了,当我进入管理区域时,外观->编辑器,我看不到子文件夹,因此无法编辑子文件夹中的那些css文件。

请帮忙,谢谢。

According the Wordpress' doc, when we create theme, we need to create style.css file in the same place with other files like header.php, footer.php, however, to make a better organization of files, I put all css files in a sub folder.

Then there comes the problem, when I go to the admin area, Appearance -> Editor, I can not see the sub folder so can not edit those css file in the sub folder.

Please help, thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

紫轩蝶泪 2024-11-04 03:29:58

在主题文件夹中创建 style.css 并包含其内容:

/*
Theme Name: Your theme name
Theme URI: http://example.com/
Description: Your theme description
Author URI: http://example.com/
*/

@import('themesubfolder/yourfile.css');

create style.css on your theme folder and have it's content:

/*
Theme Name: Your theme name
Theme URI: http://example.com/
Description: Your theme description
Author URI: http://example.com/
*/

@import('themesubfolder/yourfile.css');
深者入戏 2024-11-04 03:29:58

WordPress 中似乎存在一个问题(据我所知,在 3.3.1 版本中仍然存在),子主题子目录中的 CSS 文件无法被识别。对我来说,问题不仅仅在于在“编辑器”中看不到此类文件。子目录中的 CSS 文件根本无法工作。

是的,您可以在主 CSS 文件中使用 @import 来包含子主题目录中的另一个 CSS 文件,但它必须位于 >与主 CSS 文件相同级别。经过几个小时令人沮丧的实验后,我的结论是:子主题子文件夹中的 CSS 文件将被忽略。

There seems to be a problem in WordPress (still existing at version 3.3.1 as far as I can tell) where CSS files in a sub directory of a child theme are not recognized. For me, the problem isn't only with not seeing such files in the "editor." CSS files that are in subdirectories simply do not work.

Yes, you can use @import in your main CSS file to include another CSS file that's in the child theme's directory, but it must be at the same level as the main CSS file. After several hours of frustrating experimentation, my conclusion is: CSS files that are in a sub folder of a child theme are ignored.

黯淡〆 2024-11-04 03:29:58

做一件事,删除旧的 CSS 文件并用新的 CSS 文件替换它,如果你有两到三个 CSS 那么不用担心,将其他 CSS 文件与 Header.php、footer.php、index.php ...

使用“/FILE NAME”调用该 CSS 文件

Do one thing, delete old CSS file and replace it with new CSS file, if you have two-three CSS then d'nt worry about that, place other CSS file with Header.php, footer.php, index.php...

Call that CSS file with "/FILE NAME"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文