我使用一个以HTML5空白为父主题的子主题。我以前使用过它,没有任何问题,但出于某种原因,我现在在主题页面上得到了以下错误-
中断主题安装了以下主题,但不完整。名称描述
HTML5空白子主题父主题丢失。请安装"html5blank“父主题.
这是我文件夹里的东西-
style.css
/*
Theme Name: HTML5 Blank Child Theme
Description: A child theme of the HTML5 Blank WordPress theme
Author: Mike Whitehead
Template: html5blank
Version: 1.0.0
*/我试过很多不同的版本--也复制了官方的wordpress指南。以上的措辞对我的上一个项目有效,所以不知道为什么它现在不起作用。
这是我的函数文件-
functions.php
<?php
function my_theme_enqueue_styles() {
$parent_style = 'html5blank-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
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 ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>不知道为什么这不管用。如能提供任何协助,将不胜感激。
发布于 2017-10-05 14:46:55
子主题style.css‘模板’标记应该与父主题文件夹名称(例如。
/*
Theme Name: HTML5 Blank Child Theme
Description: A child theme of the HTML5 Blank WordPress theme
Author: Mike Whitehead
Template: html5blank-stable
Version: 1.0.0
*/根据关于儿童主题的WordPress法典页- Themes
“模板行对应于父主题的目录名。在我们的示例中,父主题是二十五个主题,因此模板将是二十五个。您可能使用的是不同的主题,因此相应地进行调整。”
发布于 2017-10-05 14:35:06
获取父主题的Textdomain并将其作为子主题的模板名。假设你的母主题的Style.css标题是这样的.
/*
Theme Name: HTML5 Parent Theme
Description: A HTML5 Blank Parent WordPress theme
Author: Mike Whitehead
Text domain: html5blank
Version: 1.0.0
*/然后你可以在你的子主题中使用这个文本域名。
/*
Theme Name: HTML5 Blank Child Theme
Description: A child theme of the HTML5 Blank WordPress theme
Author: Mike Whitehead
Template: html5blank
Version: 1.0.0
*/https://stackoverflow.com/questions/46587882
复制相似问题