One of the most common issues we see with new clients is the lack of a child theme on their website. Child themes are easy to set up and the future time savings can be huge. This post will take you through what a child theme is and why we believe you should use one.
So, what is a WordPress child theme?
The imagery in the name is actually pretty accurate. A child theme is a theme that is set up to inherit properties of the original or “parent” theme. It allows a person to modify the look and functionality of the parent theme by making edits to the child. For example: If a parent theme comes with a white background and black text but you would prefer a black background and white text, you could modify the child theme to get this look. Obviously this could be achieved by just editing the original theme, however, a child theme offers one major advantage…
Why should I use child themes?
You’ve just found an almost perfect theme for your new website. It requires one or two style changes (maybe a black background and white text) that you choose to make to the original theme INSTEAD of using a child theme. As it happens, you picked a theme from a really diligent theme author who releases a new update to the theme the week after you install it. It was a security fix, so you install the update right away. This is when you find out that the little style changes you have been making to the original theme files are all gone, overwritten by the newest version of the theme.
Cue child themes! A child theme allows for customizations (like in the example above) without running the risk of any updates to the parent theme overwriting your customizations. Quite simply, a child theme allows you to pick a theme and then customize the look and function of it, without ever losing those customizations if the theme author releases an update you want to install. That’s because none of your customizations are ever done to parent theme files! Pretty useful!
Is it easy to set up?
Yes! If you haven’t done so already, check out what the WordPress Codex has to say about child themes here. Essentially you create a new folder for your child theme in the themes directory of your WordPress site. In here, you create a style.css file that will be instructed to “monitor” the contents of a nominated parent theme. In case you’re wondering, the style.css file is basically a style sheet that defines what your website looks like – its layout, colours, fonts, and so on. After setting up your child theme (using the Codex) and activating it, your child theme will import the style.css of its parent theme and use it as its own. You can now customize the look of your website by making changes to this child style.css without altering the parent theme’s style.css. WordPress will load the child theme with your customized styles first, and then fill in the rest of your website’s design from the parent theme’s style.css. More importantly, you can now also install updates released for your parent theme with the confidence that you won’t lose your customizations.
The style.css is just the start, however. Your child theme can overwrite any file inside the folder of its parent theme. For example, you can make more drastic changes to your website’s structure or behaviour by copying files like the header.php or functions.php from the parent to inside your child theme’s folder, and then making changes to those files from within your child theme. But that’s beyond the scope of this little introduction to child themes!
This post has barely scratched the surface of child themes. We hope this article has at least highlighted the fact that they exist and given a rough idea of how they can benefit you. If you are thinking about implementing a child theme, good for you! At the absolute least, read and understand the child theme Codex. Also bear in mind that many theme frameworks come with the ability to make minor changes to a theme without the risk of losing these changes when updating. These frameworks offer an easy way to implement minor changes such as font choice, theme colours etc but won’t go as far as a child theme can. Using a framework alongside a child theme will give you the best of both worlds. We will try to post a couple of guides on child themes and frameworks in the coming weeks. Stay tuned.