【发布时间】:2019-02-28 12:53:55
【问题描述】:
我正在尝试为 Wordpress 主题二十七创建一个子主题。
我创建了一个名为二十七子的目录,并在其中创建了一个 functions.php 和 style.css 文件。
我不明白为什么我对子 style.css 所做的任何更改都没有实现。
这是我的孩子 style.css:
/*
Theme Name: Twenty Seventeen Child
Theme URL: http://tylerdevries.com
Description: Twenty Seventeen Child Theme
Author: Tyler DeVries
Author URL: http://tylerdevries.com
Template: twentyseventeen
Version: 1.0.0
Text Domain: twentyseventeen-child
*/
这是我的子functions.php
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() .
'/style.css' );
}
?>
为了测试我的新子主题,我在子 style.css 中包含了以下代码
.site-content-contain {
background-color: #d5ffa0;
position: relative;
}
我还尝试了其他简单的 CSS 自定义 - 完全没有影响。
非常感谢任何有关我做错的帮助。
【问题讨论】:
-
您没有将子主题的 style.css 排入队列,并将“父样式”设置为依赖项。