What is a Child Theme?
A child theme is a way to make changes to a WordPress theme without making changes to the main theme, the parent theme.
Why Create a Child Theme?
Whenever the theme is updated, if you apply the updates, all your changes will be lost. You will have to re-apply theme to the files. Instead of re-applying the changes every time there’s an update, it’s simpler to keep the changes in what’s known as a child theme.
How Do I Create a Child Theme?
You create a folder inside the themes directory and give it a name similar to the parent theme. For example, I decided to name the child theme for the theme I use for this blog, Panorama, “pandaughter.” Then, at the very least, you need to create a style.css with certain code at the top. See this post on the Codex to get the proper code for your child style.css:
Finally, you need to activate the child theme by going in the Admin menu to Appearance and selected your child theme from the theme choices.
Can I Do More Than Change Styles?
You can create (or re-create) any of the files in your parent theme in your child theme, such as functions.php, header.php, and sidebar.php. If it doesn’t exist in the parent theme, you can still create it in the child theme, such as category-3.php, for example. You can get quite sophisticated with your theme manipulation by unhooking functions and then recreating them in functions.php. You will find recreating the header.php will take you far in getting your header specific to your site. Then, when a theme update comes along, you won’t have to remember and redo all of your changes.
Are Some Themes Easier Parents than Others?
Certainly. You might have a very complicated theme with lots of coding, and it may be difficult to create a child easily. Conversely, some themes lend themselves to creating children. Here are a few examples:
For more posts on child themes, visit:
- WordPress Child Theme Basics
- How to make a child theme for WordPress: A pictorial introduction for beginners
- Understand WordPress Child Theme
Note: the mother and daughter in the illustration are from this painting by Robert Walker Mac Beth.