我试图在另一个开发人员创建的自定义WP主题上加载一个子主题。
我根据Codex指令创建了一个样式表,但我不确定出了什么问题。
这是我的style.css
:
/*!
Theme Name: Integrative Wisdom Child
Theme URI: http://underscores.me/
Author: Drew Lettner after Tony Klose
Author URI: http://underscores.me/
Description: Description
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: integrative-wisdom
*/
这是我的
functions.php
:
<?php
function my_theme_enqueue_styles() {
$parent_style = \'parent-style\';
wp_enqueue_style( $parent_style, get_template_directory_uri() . \'/style.css\' );
wp_enqueue_style( \'child-style\',
get_stylesheet_directory_uri() . \'/style.css\',
array( $parent_style )
);
}
add_action( \'wp_enqueue_scripts\', \'my_theme_enqueue_styles\' );
?>
最合适的回答,由SO网友:Fencer04 整理而成
样式表文件顶部的注释区域缺少所需的部分样板。你需要一句话,上面写着:
Template: [name of parent theme folder]
例如,如果父主题的/wp content/themes文件夹中的文件夹是integrational wish,则您将拥有:
/*!
Theme Name: Integrative Wisdom Child
Theme URI: http://underscores.me/
Author: Drew Lettner after Tony Klose
Author URI: http://underscores.me/
Template: integrative-wisdom
Description: Description
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: integrative-wisdom
*/