admin管理员组

文章数量:1303450

I am trying to use child themes for the first time in Wordpress - and I've got it working (at least from a user's perspective - it functions correctly)

My concern is that both the parent and child CSS files are loaded - so I'm concerned about performance. Ideally, I just want the child's CSS file used.

My code in functions.php is the following - does anyone have any suggestions how to just rely on the min.css file from the child template?

  <?php 
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); 
function my_theme_enqueue_styles() {

    $parent_style = 'johannes-style'; 

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/assets/css/min.css', array(), wp_get_theme()->get('Version'));
    wp_enqueue_style( 'johannes-child-main', get_stylesheet_directory_uri() . '/assets/css/min.css', array( $parent_style ), wp_get_theme()->get('Version')); 
}

Thanks in advance!

本文标签: templatesParentChild themesboth CSS files loaded