• Resolved amanandhishoe


    The instructions on WordPress.org about making a child theme for twentyseventeen at https://make.wordpress.org/training/handbook/lesson-plans/theme-school/child-themes/child-themes-twentyseventeen/ give this code as the way to enqueue the child theme style after the parent theme style:

    function mychildtheme_enqueue_styles() {
        $parent_style = 'parent-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 )
    add_action( 'wp_enqueue_scripts', 'mychildtheme_enqueue_styles' );

    However, I read in other places that instead of literally using ‘parent-style’ in your code, that for those making a child theme of twentyseventenn the code should be something like this:

    $parent_style = ‘twentyseventeen-style’;
    wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’ );

    However, I tried that and it does not work. The $parent_style = ‘parent-style’; works.

    • This topic was modified 2 years, 3 months ago by amanandhishoe.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter amanandhishoe


    What I find is that for some css to override the twentyseventeen css, I need to add it to the custom css in appearance. Adding it to my child theme does not work. I’ve downloaded a number of twentyseventeen child themes, but am not able to get a definitive answer on how to get child theme css to take precedence over twentyseventeen css.

    Thread Starter amanandhishoe


    I got my style.css to work by moving enque_styles function to the bottom of my functions.php file. Now the css in my style.css is overriding those of twentyseventeen style.css.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Right way to enqueue styles in child theme’ is closed to new replies.