How Can I Use A Child Theme Effectively When Parent’s CSS Is Located in a ‘CSS folder’?

I was just told to ‘enque a new style,’– does this mean write a new
@import rule?

No, it doesn’t. And in fact that is the worst way to include new stylesheets as it causes page load delays. What you want to do is something like this (straight from the Codex):

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}

Of course, your path– this part, get_template_directory_uri() . '/style.css'— may need to be different because it will need to match the location of the parent theme stylesheet(s)– though the main stylesheet should be in the root of the theme’s directory right where that example points. You will need to enqueue each of the theme stylesheets in that way.

All of this, of course, assumes that the theme does not have its own stylesheet loader (which is bad form but happens a lot) and operates as a well behaved WordPress theme should.

Leave a Comment