If you’re new to WordPress the concept of child themes might mean nothing to you. If this is the case, I’m going to tell you what WordPress child themes are. I’ll also explain why they’re so important.
By the end of this post I’ll answer:
- What are WordPress child themes?
- What do they do?
- Why are child themes so important?
Introduction to WordPress Child Themes
Let’s imagine a scenario.
You’ve been using WordPress for a while and have a theme you’re really happy with. You’ve even made some modifications to the theme and feel you’ve made it even better.
Logging in to WordPress one day you see there’s a theme update available.
You click to upgrade. When the update completes you notice all your modifications have disappeared. You’ve also lost all the improvements you’d worked so hard to put in place.
You have no way of retrieving all the changes you added because they were only in the theme files that have just been updated. Now they’re all gone.
This in a nutshell is why child themes are important.
Have you figured out what the best WordPress theme is for you?
What is a Child Theme?
Let’s go back to the original theme you used and modified. Think of this as your parent theme.
Your parent theme contains all the style rules for how your blog looks when you activate the theme. It also includes additional functional enhancements to your core WordPress installation.
Child themes share the look and feel of a parent theme and they use the same functional enhancements. However, child themes can have their own rules about look and feel. They can also have functions that do different things over and above those of its parent.
Child themes are used to modify a parent theme without touching the parent theme code itself. A child theme then references its parent but allows you to make tweaks to its design and functions outside of the parent.
WordPress child themes are themes in their own right. They have their own directory in the WordPress theme directory hierarchy on your server and they appear in the Appearance > Themes navigation menu in your WordPress dashboard.
So where do they come from?
Child themes are created by you. You create a file theme directory on your server and add style rules and functional files to it that inform WordPress about the parent / child relationship. This enables you to use the parent as a main theme, but include all the characteristics of your child at the same time.
Why Use a Child Theme?
As I’ve touched upon above, the most important reason to use a WordPress child theme is to keep intact any customization you make to your main parent theme. This means you can comfortably upgrade the parent theme a child references knowing that you won’t lose anything. However this is not the only advantage:
- Updating a parent theme directly can get you into trouble if you accidentally remove something important or add code that breaks the theme and causes WordPress to crash.
- You can share child themes with other WordPress users who have the same parent as their theme.
- Learning how to create child themes and add functions to it can help you to learn more about WordPress.
- When you know how to create a child theme, you’ll be able to safely extend the features of any WordPress theme you ever use.
- You can use child themes to “build” your own theme. You find a theme you like and then customize it by adding your own code over the top of it.
- Your main WordPress theme is a parent theme.
- A child theme uses all the style rules and code of a parent, but includes its own style and / or functions that override it.
- Child themes enable you to update your parent theme without the risk of breaking WordPress by directly editing the parent code.
- When you use a child theme, you can safely update your parent theme without overwriting your custom style rules and functions.
Look out for my upcoming post about how to create WordPress child themes!
That’s it for now,
Do you use a WordPress child theme? Drop me a comment below and let’s compare notes!