【发布时间】:2017-10-05 14:15:02
【问题描述】:
我正在使用 HTML5 Blank 作为父主题的子主题。我以前使用过这个没有任何问题,但由于某种原因,我现在在我的主题页面上收到以下错误 -
破碎的主题
以下主题已安装但不完整。
名称 说明
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' );
?>
不知道为什么这不起作用。任何帮助将不胜感激。
【问题讨论】:
-
父子主题目录的名称是什么?这可能是命名约定的问题。
-
你的父主题是否有这个文件夹名称:html5blank
-
@Dedering 父目录名是 html5blank-stable 这会改变吗?
-
@AkshayShah 见上面的答案
-
请看我的回答。子主题的“模板”标签应与父主题的文件夹名称匹配。