• Resolved loiruca

    (@loiruca)


    Hello, I just downloaded sixteen and created a child theme. When I import the css to my style.css in child theme the header and main navigation break. I didn’t even add any styles to it. It breaks just by importing like so @import url(“../sixteen/css/main.css”);
    Does this theme works with child theme and its a easy fix? Can someone help me here?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there!

    I just tried setting up a child theme and its working just fine without the issue you mentioned.

    Perhaps take a look at this documentation:.

    @import should not be used to import the parent stylesheet into the child theme. The correct method is to use wp_enqueue_style() to enqueue the parent stylesheet, using this code in your child theme’s “functions.php”. You will need to create a functions.php in your child theme’s root folder. Right at the start, on the first line, you should add an opening php tag. All other code will follow after this opening php tag

    <?php
    
    add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
    function enqueue_child_theme_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
        wp_enqueue_style( 'child-style', get_stylesheet_uri(), array('parent-style')  );
    }

    and see if that works.

    I hope that helps!

    Luke the Daft Duke

    Thread Starter loiruca

    (@loiruca)

    It totally works Luke! Thanks so much!

    I’m having the same problem using a sixteen child theme. This is probably a dumb question, but what do I put in place of ‘parent-style’ and ‘child-style’?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sixteen child theme???’ is closed to new replies.