我正在制作一个简单的儿童主题"Grow Minimal" 主题
我创建了一个文件夹,grow-minimal-child
并添加functions.php
和style.css
:
functions.php
:
function my_theme_enqueue_styles() {
$parent_style = \'grow-thinkup-style-minimal\'; // This is \'twentyfifteen-style\' for the Twenty Fifteen theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . \'/style.css\' );
wp_enqueue_style(\'thinkup-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\' );
以及
style.css
:
/*
Theme Name: Grow Minimal Child
Theme URI: https://www.thinkupthemes.com/free/grow/
Author: Think Up Themes
Author URI: https://www.thinkupthemes.com
Description: Created for customizing...
Template: grow
Version: 1.0.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: one-column, two-columns, three-columns, right-sidebar, left-sidebar, custom-header, custom-menu, full-width-template, theme-options, threaded-comments, editor-style, featured-images, featured-image-header, post-formats, sticky-post, translation-ready, flexible-header, custom-background, grid-layout, footer-widgets, blog, e-commerce, portfolio, rtl-language-support
Text Domain: grow-minimal-child
*/
所以,如果你看到我没有真正添加任何CSS。然而,现在当我激活这个子主题并访问该网站时,它看起来有点不同。似乎父CSS被完全忽略了。我还尝试使用
$parent_style = \'parent-style\'
,
$parent_style = \'thinkup-style\'
.
这是functions.php
在…内Grow-minimal
文件夹:
function grow_thinkup_child_frontscripts() {
wp_enqueue_style( \'thinkup-style\', get_template_directory_uri() . \'/style.css\', array( \'thinkup-bootstrap\' ) );
wp_enqueue_style( \'grow-thinkup-style-minimal\', get_stylesheet_directory_uri() . \'/style.css\', array( \'thinkup-style\' ), wp_get_theme()->get(\'Version\') );
}
add_action( \'wp_enqueue_scripts\', \'grow_thinkup_child_frontscripts\' );
当我把主题改回
Grow Minimal
, 该站点看起来与预期一致。
css哪里出了问题(或者更可能的是,我在哪里没有更新或将孩子链接到家长)?