Child theme is a WordPress theme which derives functionalities from the parent theme. A child theme should contain a style sheet file as a minimum. There are two ways you can add functions to site using child theme.
- Using functions.php – any function you add to your website using functions.php file of child theme will be appended to the parent theme’s function.
- Using other PHP files like header.php, single.php, etc. – when you use these template PHP files in child theme, they will overwrite the corresponding files in parent theme.
Why to Use Child Theme?
WordPress by default offers a theme editor to edit theme’s PHP files. You can access the theme editor in admin panel under “Appearance > Theme Editor” menu. However, all changes you made through theme editor will be deleted whenever you update your theme. Therefore, use child theme to protect the custom changes getting overwritten when parent theme is updated.
In addition, you can add custom CSS to your site under “Appearance > Customizer > Additional CSS” section.
How to Create Child Theme?
There are three ways to create child theme:
- If you are using premium commercial themes, check whether your theme developer offer child theme as a package.
- You can manually create child theme.
- Use WordPress plugins to create a child theme for you.
Article last updated on November 6, 2020