Enqueue Child Theme CSS in Functions.php File
You need to enqueue both the parent theme style.css and the child theme style.css in your child theme.
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' );
A few things are happening here:
- You’re setting the name of the parent theme’s style.css
- You’re enqueuing the parent theme’s style.css
- You’re enqueuing the child theme’s style.css
editor's pick
latest video
news via inbox
Nulla turp dis cursus. Integer liberos euismod pretium faucibua