这是一个基本的WordPress问题,请熟悉主题主题的概念。
基本主题:https://codex.wordpress.org/Theme_Development子主题:https://codex.wordpress.org/Child_Themes
Theme hierarchy
Parent theme style.css
/*
Theme Name: Twenty Fifteen
Theme URI: https://wordpress.org/themes/twentyfifteen/
Author: the WordPress team
Author URI: https://wordpress.org/
Description: Twenty Fifteen
Version: 1.3
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: twentyfifteen
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.
*/
Child theme style.css
/*
Theme Name: Twenty Fifteen Child
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
*/
注:
Template: twentyfifteen 这一部分非常重要。模板名称应与父模板文件夹名称匹配。
这是WordPress中子主题工作原理的一个基本示例。您可以在模板文档中找到更多信息。