What is a Child theme in WordPress?
A child theme is a WordPress theme you can install that links to an existing theme. It would inherit all the functionalities and settings of the “parent” theme and allow you to add your own styling and your own additional code snippets. The magic of a child theme is that your customization will stay untouched, even after you update the parent theme.
The core of a child theme consists of 2 files.
style.css
/*
Theme Name: <Theme name> Child
Description: My new child theme
Template: <the directory name your parent theme is stored in>
Version: 0.1
*/
functions.php
This file would start empty, and you can keep adding your favorite hooks, filters and other pieces of code.
How to install a Child Theme?
Save the 2 files mentioned above in a directory, zip it and install it on your WordPress website as you would any other theme. When you activate it, it will detect your parent theme and activate both. WordPress also provides extensive documentation regarding child themes.
What other benefits does a child theme offer?
Most advanced plugins like WooCommerce, Events Calendar, or LearnDash allow you to override templates by creating your own copies in a child theme. This is one of the most powerful customizations tools that makes WordPress so extendable.
If your site does not include a child theme, you should add one today.