为什么我的子主题没有使用新的style.css文件?


Why isn't my child theme using the new style.css file?

我遵循了一个关于如何排队子主题的非常简单的教程,但是当我实际去编辑我的style.css时,什么也没有转移过来。我是否错误地使用了给出的代码?

style.css

/*
Theme Name: Blank Slate Child
Theme URI: http://www.efficientmind.org/blankslate-child/
*/

functions.php中的排队代码

<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>

子主题样式表头需要包含Template行(父主题名称)才能工作。

codex |儿童主题

的例子:

/*
Theme Name:     Twenty Thirteen Child
Theme URI:      http://example.com/
Description:    Child theme for the Twenty Thirteen theme
Author:         Your name here
Author URI:     http://example.com/about/
Template:       twentythirteen
Version:        0.1.0
*/

将以下注释添加到子主题的style.css文件中:

Template: BlankSlate

你的新Style.css应该看起来像这样:

/*
Theme Name: Blank Slate Child
Theme URI: http://www.efficientmind.org/blankslate-child/
Template: BlankSlate
*/