是否可以创建一个自定义的 Wordpress 它们而不是在主题的根目录中创建 style.css
文件?如果可能,我想完全删除 style.css
。
最佳答案
您不能使用 style.css
创建自定义主题。但是没有必要将您的样式添加到 style.css
。您只需在 style.css 中添加标题部分。它用于显示主题名称、主题网址、作者姓名、作者网址等。您可以在主题文件夹中的任何位置创建自定义主题。您只需在 header.php
中包含自定义 css 路径。
下面给出的是您应该保留在 style.css
中以使主题正常工作的唯一代码。这是 Twenty Fourse
主题的示例。您可以将其替换为您的。
/*
Theme Name: Twenty Fourteen
Theme URI: http://wordpress.org/themes/twentyfourteen
Author: the WordPress team
Author URI: http://wordpress.org/
Description: In 2014, our default theme lets you create a responsive magazine website with a sleek, modern design. Feature your favorite homepage content in either a grid or a slider. Use the three widget areas to customize your website, and change your content's layout with a full-width page template and a contributor page to show off your authors. Creating a magazine website with WordPress has never been easier.
Version: 1.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: black, green, white, light, dark, two-columns, three-columns, left-sidebar, right-sidebar, fixed-layout, responsive-layout, custom-background, custom-header, custom-menu, editor-style, featured-images, flexible-header, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready, accessibility-ready
Text Domain: twentyfourteen
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.
*/
关于css - 创建没有 style.css 的自定义 Wordpress 主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26347561/