douyulv6921 2017-10-05 14:15
浏览 66
已采纳

Wordpress - 子主题无法完成安装

I'm using a child theme with HTML5 Blank as the parent theme. I've used this before without any issue but for some reason I'm now getting the following error on my themes page -

Broken Themes The following themes are installed but incomplete. Name Description
HTML5 Blank Child Theme The parent theme is missing. Please install the "html5blank" parent theme.

This is what I have in my folder -

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
*/

I've tried numerous different variations on this - also copying the official wordpress guide. The above wording worked for me on my last project so don't know why it won't work now.

This is my functions file -

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' );
?>

Not sure why this isn't working. Any assistance would be appreciated.

  • 写回答

2条回答 默认 最新

  • duancong6937 2017-10-05 14:46
    关注

    The child themes style.css 'Template' tag should match that of the parent themes folder name eg.

    /*
     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
    */
    

    As per the WordPress Codex page on Child Themes - https://codex.wordpress.org/Child_Themes

    "The Template line corresponds to the directory name of the parent theme. The parent theme in our example is the Twenty Fifteen theme, so the Template will be twentyfifteen. You may be working with a different theme, so adjust accordingly."

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程