What is a Child Theme and Why Use One?
A child theme is a theme that inherits the styles and functions of another theme, called the parent theme. Child themes are the recommended way of modifying the existing theme one has selected to use for their WordPress site.
A few reasons to use a child theme are:
- If you modify a theme directly and update it later, your modifications will most likely be lost. A child theme will ensure your modifications are preserved.
- Using a child theme allows you to make changes without affecting the code of the original theme.
- A child theme creates a separate set of files that can be used to customize the theme without making changes to the original theme.
- You can create multiple child themes, which can be used to “test” potential changes you would like to make to the styles and/or functions of your theme.
- If necessary, you will always have an original, unmodified, theme to fall back on.
- Using a child theme can speed up development time.
- Using a child theme is an easy way to learn about WordPress theme development.
Recommended Preparation Before Creating a Child Theme
Before creating a child theme, or undertaking any modification tasks to your WordPress theme, it is recommended that you ensure you have a current backup of your WordPress site (files and database).
If you haven’t done this, or are unsure how to do this, please visit the links below:
WordPress.Org Codex—Backing Up Your WordPress Files
WordPress.Org Codex—WordPress Backups
How to Create a Child Theme
There are two methods to creating a child theme: 1) downloading and using a plugin and 2) manual creation, a four-step process.
*Note* If you have already modified your parent theme, there will be some additional steps. All php files and css files that you have modified will need to be copied over to the child theme directory. With functions.php, you may receive errors if you copy the parent theme’s functions.php file in its entirety to the child theme. If this occurs, you’ll need to compare an original, unmodified version of your parent theme’s functions.php file to your modified functions.php file and include only the modifications/additions to your child theme’s functions.php file.