Quick Explanation: WordPress Child Themes

I was recently asked about WordPress “child themes” and why they’re needed. The point of having a parent/child theme is so that you can make all your changes and customizations to the design in the child theme, primarily so that the parent theme can be updated without effecting the child theme.

If you had a single, standalone theme, e.g. TwentyTwelve, and made changes to its files, your changes would be overwritten the next time WordPress updates the theme.

The Detail

How it works with the files is this: Child themes always have a style.css file and then a number of other files based on the parent’s theme files.

E.g. if you want to change the design for single blog post pages, but keep everything else the same you’d need at least the following:

Parent theme has:


Child theme has:

style.css (at a minimum)

Customize the Single Posts

You’d copy single-post.php from the parent theme and then edit it however you like in the child theme. The child theme version of single-post.php will then be used instead of the single-post.php from the parent when single posts are displayed.

Fallback to Non-Customized Files

But if in this example, WordPress needs to display an “xxx” or a “yyy” page then because there are no equivalents in the child theme, it will use the xxx.php and yyy.php files from the parent theme.

That’s parent-child themes in a nutshell. I hope to write a more detailed tutorial on this in the future, in the meantime you can find out more on the WordPress Child Themes codex page, and on this child theme development article.

Source: Quick Explanation: WordPress Child Themes by on WebsiteDoctor