我正试图在wordpress上安装一个子主题。无论出于什么原因,我都不能安装它,因为它说这两个主题都标识为子主题。我有一个问题,当我创建我的孩子主题标题,所以我进入到wordpress的代码,只是复制他们的风格,并取代了相关的信息。以下是常规主题的style.css:
/*
Theme Name: consulting
Theme URI: http://example.com/twenty-fifteen-child/
Description: consulting
Author: John Doe
Author URI: http://example.com
Template: consulting
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: consulting
*/关于儿童的主题
/*
Theme Name: consulting-child
Theme URI: http://example.com/twenty-fifteen-child/
Description: consulting child theme
Author: John Doe
Author URI: http://example.com
Template: consulting-child
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: consulting-child
*/我知道它们对大小写很敏感,所以我确保所有的东西都匹配,但还是什么都没有。谢谢你的帮助。
编辑:
这是functions.php代码
<?php
function my_theme_enqueue_styles() {
$parent_style = 'consulting-style'; // This is 'consulting-style' for the consulting theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'consulting-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>发布于 2018-04-07 00:25:45
子主题中的模板行对应于父主题的目录名。如果父主题位于一个名为"consulting“的目录中,那么在子主题的标题中就需要这样的内容:
Template: consulting将模板行完全排除在父主题之外。
在常规主题的style.css中使用这个:
/*
Theme Name: consulting
Theme URI: http://example.com/consulting/
Description: consulting
Author: John Doe
Author URI: http://example.com
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: consulting
*/假设您的父主题位于“咨询”目录中,请在您的子主题的style.css中使用它:
/*
Theme Name: consulting-child
Theme URI: http://example.com/consulting-child/
Description: consulting-child
Author: John Doe
Author URI: http://example.com
Template: consulting
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: consulting-child
*/https://stackoverflow.com/questions/49702574
复制相似问题