• Resolved mica123

    (@mica123)


    I have a child theme. Is its style.css loaded along with the parent theme? Or will I have to add this to function.php:

    add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
    function my_theme_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 ),
        wp_get_theme()->get('Version')
    );

    }

    I would be grateful for your input.

    Thanks.

    • This topic was modified 8 months, 1 week ago by mica123.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there,

    Thank you for reaching out.

    You have to add the code to function.php of your child theme.

    Feel free to reach out for any further queries.

    Best Regards,

    Pratik

    Team Cyberchimps

    Thread Starter mica123

    (@mica123)

    Thank you. I just wanted to know if this code is correct for your theme. Can you please confirm? I will then add it to function.php.

    Best regards

    Hi there,

    The code is indeed correct and you can add it to function.php file.

    Regards,

    Pratik

    Team Cyberchimps

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