From the course: WordPress: Building Child Themes

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add new styles

Add new styles - WordPress Tutorial

From the course: WordPress: Building Child Themes

Start my 1-month free trial

Add new styles

- [Instructor] The child theme style sheet is not just for overriding existing styles from the parent theme, you can also use it to add entirely new styles. So let me give you a practical example of this that also contains some fairly advanced CSS. We have a lot of recipes on our blog as well as regular blog posts, and it's pretty common to style different genres a little differently. If I scroll through my list of posts, in the Element Inspector, I can see that Recipes have a class of category recipes. So I'll scroll up here and under article, I can see category dash recipes. I can use this class to write entirely new styles that apply only to that category. As before, we'll start by doing that in the Style Editor so we can design in the browser. And instead of selecting an existing selector, like .entry we're going to use a new one. So we're going to click this little plus button, New Style Rule, and that'll automatically give me a New Style Rule and the Style Rule will always grab…

Contents