What are Parent and Child Themes?
Many of the new themes now include Parent and Child themes which can be confusing to new users.
The parent theme acts as a base for the child. How it works is the parent theme contains the programming that creates the function and features of your site while the child theme contains the images and styles that form the base for your site’s layout and design.
This parent/child framework protects the theme while allowing you to customize the theme.
In the past, if you customized a theme and went to upgrade to a newer version you would need to find all your changes in the customized theme and then recreate them in the newer version of the theme — otherwise you would lose all your customizations when you upgrade. This is a very time consuming process.
With the parent/child framework all customizations are stored in the child theme and anything in the child takes priority over the parent. So if the same file is in the child and in parent the file in the child theme will control that aspect of the theme.
Your customizations are safeguarded from future upgrades because you only upgrade the parent theme, which you never edit, while the customizations are protected in your child theme which you don’t upgrade.
Using Parent and Child Themes
When you install a theme that uses a parent/child framework you upload both parent and child theme folders to /wp-content/themes/ but only enable the Child theme so only the child theme is available to use via Appearance > Themes.
The parent theme must be installed, but not activated, in your site’s themes directory for the child theme to work.
- When you install BuddyPress Social theme you upload the bp-social and bp-social child folder to /wp-content/themes and then only activate the ‘BuddyPress Social Child’ theme.
Modifying Files From The Parent Theme Folder
While you should never edit files in your Parent theme you can download a copy of the file you want to modify onto your computer, make the changes, and then upload it into your child theme folder. Any files that are uploaded to the child theme automatically override those in the parent theme as anything in the child takes priority over the parent. So if the same file is in the child and in parent the file in the child theme will control that aspect of the theme.
This technique can be used for any files and folders within the parent theme — but you must re-create the same folder and filenames structure in your child theme that exist in the parent theme folder.