JGallardo
JGallardo

Reputation: 11373

What code do we mdoify in functions.php for a WordPress child theme?

I was following along to this example in the official tutorial

<?php
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')
    );
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>

But then they had this line

where parent-style is the same $handle used in the parent theme when it registers it's stylesheet.

What does that even mean?

I am creating a child theme for Bazaar Lite and the directory name is bazaar-lite

How should I modify my file?

Upvotes: 0

Views: 34

Answers (1)

nibnut
nibnut

Reputation: 3127

Looks like a bit of a typo in the docs, actually. If you look at the simpler example just above that one on the doc page, they use "parent-style" literally. You could still use "parent-style" no problem there.

So to answer your question, you should be able to use that code that you showed as is, without any modifications.

Hope this helps!

Upvotes: 1

Related Questions