还要确保在子主题之前添加父主题样式。将其放入子主题的“functions.php”文件中,看看是否有帮助:
// Flush all output buffers in PHP:
remove_action(\'shutdown\', \'wp_ob_end_flush_all\', 1);
// Making sure your child theme has an independent version and can bust caches: http://wordpress.stackexchange.com/a/182023/30783
// Filter get_stylesheet_uri() to return the parent theme\'s stylesheet
add_filter(\'stylesheet_uri\', \'use_parent_theme_stylesheet\');
// Enqueue this theme’s scripts and styles (after parent theme)
add_action(\'wp_enqueue_scripts\', \'my_theme_styles\', 20);
function use_parent_theme_stylesheet()
{
// Use the parent theme’s stylesheet
return get_template_directory_uri() . \'/style.css\';
}
function my_theme_styles()
{
$themeVersion = wp_get_theme()->get(\'Version\') . rand();
// Enqueue our style.css with our own version
wp_enqueue_style(\'child-theme-style\', get_stylesheet_directory_uri() . \'/style.css\',
array(), $themeVersion);
}