Chapter 5: The Child Theme Concept

As a WordPress designer, one of the things you need to keep in mind is the addition of new features with new versions of WordPress, and in turn the deprecation of old ones. A theme created a few years ago will probably still work, but it will definitely be lacking some of the functionality of more modern themes. And the question is, will it still work in another few years? The backward compatibility in WordPress is pretty extensive, but there is a limit.

Compatibility is one of the many reasons why you create core themes to build on and why using child themes to extend them is such a great idea. In a way, the child theme concept is all about moving the individual styling for the sites you create another step from the code because the child theme will consist mostly of visual enhancements and changes to the parent theme. This means that the user can update the core theme without breaking anything.

This chapter is dedicated to the brilliance of child themes and how you can use them effectively for your own projects.

The Brilliance of Child Themes

Child themes let you create themes that rely on other themes, called parent themes, as templates, by changing parts of the parent theme to suit your own needs. For example, say you love a particular theme but dislike the fonts and colors. You may also think that it needs a few Page templates to meet your needs. There are two ways to tackle this problem. The most obvious method is the direct route: Just ...

Get Smashing WordPress: Beyond the Blog, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.