Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My WordPress site uses a theme that is a child of a parent theme. As required, both themes have style.css files. However, as far as I can tell WordPress only provides the mechanism to load the child theme style.css file. How do the parent theme styles get loaded? Is it necessary to manually import the parent theme's style.css file into the child style.css file?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

At the top of your child themes style.css add:

@import url("../twentyeleven/style.css");

Obviously replace twentyeleven with your parent themes folder.

share|improve this answer
    
OK- what I thought, just wanted to make sure that's the only way.. - thanks –  Yarin Sep 13 '11 at 18:58
    
"using @import: this is no longer best practice." - see codex.wordpress.org/Child_Themes –  Tara Mar 19 at 17:48
1  
So you came back 3 1/2 years to downvote it? In September 2011 it was the expected way to build child themes for WordPress. –  Alex Older Mar 24 at 13:58

You can call the parent css as a separate file in your theme header.php Something like

<link href="<?php echo get_stylesheet_directory_uri(); ?>/css/css.css" rel="stylesheet">

Depending on various factors it may be better to copy and paste the parent css into your child css file, and thus no need to import it at all. Saves http requests etc.

share|improve this answer
    
this works & thus answers the question. If you dont like the application you could explain in a comment –  Jon Aug 11 at 6:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.