The 101 on WordPress child themes and why they’re important. A WordPress child theme saves you time, provides greater flexibility and added security.
Summary: Child themes in WordPress let you customize a site without affecting the original theme. They make updates safer and keep your changes intact when the main theme is updated.
If you’ve been following along with our posts you would have learned by now that we’ve used WordPress.org for this blog. In our recent post on how to set up WordPress, we mentioned the creation of a child theme. So, what is a child theme? Let me explain…
WordPress child theme
A child theme is essentially an empty theme that sits below your parent (or chosen) theme. It inherits everything from the parent theme, but allows you to make modifications to the styling and functionality of your site without impacting the parent theme.
When should you use a child theme?
A lot of themes have inbuilt customisation tools that allow you to modify the look and feel of your site. But when the theme doesn’t have inbuilt tools, or you need to make small changes beyond what’s readily customisable then a child theme should be created.
Full disclosure: I think it’d be hard (but not impossible!) if you don’t have some base knowledge of HTML/CSS and PHP. In saying that, there’s always Google and most themes come with invaluable support and FAQ sections.
Why it’s important
Three words: time, flexibility and security.
Time
When you pick a theme (parent) you’re choosing to use something that’s been tested, supported and often has ongoing updates and feature development. A pre-built theme comes with inbuilt styling, features and functionality. All of which, saves you time if you’re not having to develop these from the get go.
By using a child theme in addition to a parent theme, you’re essentially piggy backing off those features listed above. Again, saving you time. A child theme allows you to make small modifications to a parent theme, without having to start a theme from scratch.
Flexibility
Once you’ve picked a theme there might be a select number of things that you can’t easily modify. By creating a child theme, you’re giving yourself greater flexibility to have your site looking and operating just the way you want. Some things we modified in our child theme were: the 404 error page, adding the ‘reading time’ on index pages, header modifications and some changes to individual post pages.
Security
Again, a pre-built theme has done all the hard work for you. It’s been tested, and it’s supported. By using a child theme you can continue to update your parent theme and receive security updates, features improvements and bug fixes. When you update the parent theme you don’t lose anything you’ve modified in your child theme.
Resources
Here’s some great resources to learn more about child themes and how to go about creating one:
- Child themes in the WordPress developer handbook
- WP Beginner steps on installing a child theme
- If you sign up to Dreamhost* for your website hosting, then this is a helpful tutorial to follow
* Full disclosure: while we’re in this for love (not money!), signing up for Dreamhost with our referral link will earn us a tiny kickback on our website hosting costs.