我知道人们有类似的问题,但通过在这里stackoverflow和WP Codex上的问题阅读,并没有帮助我解决这个问题。 这是我做的第二个孩子主题。第一个工作完美。出于某种原因,即使我做了同样的事情,但这并不反映父主题的格式。我的怀疑是,我需要为这个特定的主题排列多个.css,或者我有一个不正确的标签。希望一组新的眼睛能够找到问题。WordPress儿童主题不格式化
这里是孩子主题的style.css:
/*
Theme Name: Kale-child
Theme URI: https://panaceats.com/
Author: ****
Author URI: https://panaceats.com/
Description: child theme of Kale
Template: kale
Version: 1.0.0
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.en.html
Text Domain: kale
Domain Path: /languages/
Tags: one-column, two-columns, three-columns, right-sidebar, grid-layout, flexible-header, custom-background, custom-colors, custom-header, custom-menu, featured-images,footer-widgets, full-width-template, theme-options, threaded-comments, translation-ready, food-and-drink
*/
这里是为孩子主题的functions.php:
<?php
function my_theme_enqueue_styles() {
$parent_style = 'kale-style';
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');
?>
正如你所看到的,我也跟着从WP Codex - CT方向。
This是格式应该是什么样子。
更新:我现在通过从父级style.css中将所有内容复制/粘贴到子级,我的子级主题看起来像父级主题。但是,这不是击败入队的目的吗?如果我父母和孩子入队正确,是否父母的格式不反映在孩子主题中?
在header.php中添加头部样式并且不使用这个愚蠢的函数 –
“羽衣甘蓝样式”与Kale主题在调用style.css时使用它的functions.php中的相同处理? – Leland