我已经创建了一个父主题的子主题,它在wp主题选择器上正确显示并激活。
我创建了一个包含以下元信息的子主题的style.css:
/*
Theme Name: Twenty Sixteen Child
Theme URI: http://localhost:888/wordpress-test/twentysixteen-child/
Description: My first child theme, based on Twenty Sixteen
Author: Juan D. Bolanos
Author URI: http://synchronygroup.com
Template: Twenty Sixteen
Version: 1.0.0
Tags: black, green, white, light, dark, two-columns, three-columns, left-sidebar, right-sidebar, fixed-layout, responsive-layout, custom-background, custom-header, custom-menu, editor-style, featured-images, flexible-header, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready, accessibility-ready, responsive-layout, infinite-scroll, post-slider, design, food, journal, magazine, news, photography, portfolio, clean, contemporary, dark, elegant, modern, professional, sophisticated
Text Domain: twentysixteen-child
*/我创建了一个上述主题的function.php文件,并使用wp_enqueue_styles函数作为引用的这里。
<?php
function wordpress_main_style() {
wp_enqueue_style( 'parent-theme', get_template_directory_uri() . '/style.css');
wp_enqueue_style( 'child-theme', get_stylesheet_uri());
}
add_action( 'wp_enqueue_scripts', 'wordpress_main_style' );
?>我已经将wp_head()包含在我的header.php中,并调用到了我的index.php中。样式表显示在站点上,如检查器中所示,但“父主题”样式表指向与父目录相关联的子主题目录。
我已经确保文件夹名与在我的子主题中包含'- child‘匹配。我读过这个文档,以确保没有任何错误。
有什么可能会导致目录中的错误方向呢?
发布于 2016-11-03 15:45:31
如果您查看原始文章:
Template: twentyfourteen我们看到提到了文件夹twentyfourteen,也就是“二十四号”主题。
而你有:
Template: Twenty Sixteen它是主题的人类可读的名称,而不是主题文件夹名。这就是你需要写的:
Template: twentysixteenhttps://wordpress.stackexchange.com/questions/244964
复制相似问题