Why and how to always use a child theme.
Long story short, it saves all your theme customizations. So you can update your theme freely without ever losing your theme customizations:
- Customizer (settings)
- Style.css (modifications)
- Functions.php (modifications)
Most people customize their theme and website appearance in either of the three places above. They either choose or enter settings in the Appearance > Customizer, paste CSS code into the style.css, or paste code snippets into the functions.php file.
And while that are the proper ways to customize your theme, they have one big risk. The risk is if your theme has an update…it might overwrite your settings, style.css modifications, and functions.php hacks. So THIS is why everyone tells you use a child theme.
How to activate a child theme
Thankfully, it ain’t that hard.
- Go to your theme website and download their sample child theme. (For example, here’s the GeneratePress blank child theme).
- Go to your theme settings and “Export settings” to a file. If your theme doesn’t have an option to export settings, skip this part.
- Install and activate your child theme.
- Then re-import your theme settings into the child theme…or if you couldn’t export the settings previously, then you’ll have to re-do all your settings and customizations.
- OPTIONAL – go to the child theme folder and put your name and url into the top of the style.css (replacing the existing stock theme name). You can also put your own screenshot.png image (880px by 660px) so it looks like your site.
Does your theme not allow for child themes? Ouch, it’s probably an outdated one and should be replaced by a newer better WordPress theme.
What is a child theme anyway?
- You can think of “parent theme” as a complete theme, complete with all the coding and styling files needed.
- And a “child theme” as an addon to the parent theme, that has only the extra styling and functions that apply specifically to that child theme.
Child themes are useful because you can put all your customizations into the child theme, and then the parent theme is free to update often and you never lose your modifications. Child themes are also useful for developers to sell their own pre-made theme designs without having to code a brand new theme from scratch. You can think of it as like an iPhone case. The parent theme is the actual phone, and a child theme is just the design cover that goes over it. (Honestly not sure this is even a good analogy. But I hope you get the point.)