Sometimes, a particular WordPress theme is exactly what you were looking for. After evaluating the demo, you purchased or downloaded the files, installed and activated it, and perhaps with a few small customizations in the settings, it’s exactly what you needed.
However, things don’t always work out so perfectly. Sometimes, you need to make tweaks, or even pretty substantial changes, to make the theme work for your website. That’s where WordPress child themes come in.
Before you make any large changes to your theme’s CSS and PHP files, stop and decide if it makes sense to create a child theme first. If it does, or you’re not sure what a child theme is, keep reading to learn everything you need to know to start using a WordPress child theme.
What is a WordPress Child Theme?
A WordPress child theme is a theme that inherits styles and functionality from a “parent” theme. This means that if something is not defined in your child theme, WordPress will fall back to the parent theme.
Using a child theme separates any changes you want to make to the theme from the base theme’s code and styles. This is important because if the changes you make are not separated, they are overwritten when you update the theme. In a complicated theme, it can be extremely difficult to find your customizations amidst the default code. If you use a child theme, however, those customizations are the only code you’ll see.
When Should I Use a WordPress Child Theme?
It is a good idea to use a WordPress child theme anytime you plan to make changes to your theme’s PHP files. It’s also recommended that you use a child theme if you plan to make extensive changes to your theme’s CSS.
This is important for two reasons: it’s easy to see what you changed, and you do not need to worry about losing those changes when you update your theme after a new version is released.
When Shouldn’t I Use a WordPress Child Theme?
Even with all their advantages, there are cases when it is just not necessary to use a child theme.
For example, if you intend to make small changes just to the CSS, and not the PHP, of your theme, you don’t need a child theme. In this case, all you need to do is save your custom styles in your WordPress Customizer. Simply navigate to Appearance > Edit CSS in your WordPress admin and paste the new styles into the code box.
Another case where you don’t need to use a child theme is if you can create the functionality you are seeking with a plugin. Then, instead of editing your PHP files manually, you can just use the plugin.
How to Get Started with WordPress Child Themes
To use a child theme, you need two WordPress themes installed on your site: the parent theme, and the child theme. The child theme is the one you will actually have set as active on your site, but it will import styles from the parent theme.
Many theme developers include a child theme with their themes, so this is the first place to check. Most developers’ child themes will consist of a .zip file containing a screenshot of the theme, a mostly-empty CSS file, and perhaps a few PHP files.
Upload both the parent theme and the child theme like you would any WordPress theme, then activate the child theme.
That’s it! Once the child theme is activated, it should automatically create the connections required to the parent theme, and you can customize away.
How to Fix the Parent Theme Not Found Error
Having problems? If you upload a child theme without uploading the parent theme, WordPress will attempt to download the theme automatically from the theme repository. If it is unavailable (for example, if it is a premium theme), it will display an error message like this:
To fix this problem, just install the parent theme.
If Necessary, Create a WordPress Child Theme
If, on the other hand, the theme package you downloaded does not include a ready-to-use child theme, you’ll need to create one.
You can do this manually, by creating the only required file, styles.css, and uploading your new child theme to your website. However, like most functionality in WordPress, plugin developers have made things infinitely easier for us by creating plugins that do it for us.
A popular WordPress child theme plugin is called Child Theme Configurator. This plugin is still actively maintained and is installed on over 100,000 WordPress sites.
After installing and activating the plugin on your site, follow these steps to create your child theme:
1. Navigate to Tools > Child Themes in your WordPress admin.
This is where you will find all the settings and features of the Child Theme Configurator plugin.
2. Select “CREATE a new Child Theme” and choose the parent theme from the dropdown.
If you do not have any child themes installed, your options will look like the screenshot below. If you do have a child theme installed, you will see other options, but you can still follow these steps to create a new child theme.
3. Click the blue “Analyze” button.
The plugin will analyze the parent theme and determine if it is okay to build a child theme from. Once the analysis is complete, additional steps will appear below.
4. Verify that the auto-generated theme directory name is okay.
This is just the name of the folder where the child theme is stored. You can rename the actual child theme and how it appears in the Themes selector further down the page.
5. Choose where to save new CSS.
Since we are creating a new child theme, your primary stylesheet should be empty, so we can leave this on the default, “Primary Stylesheet.”
If you were analyzing a child theme you had already made customizations to, you would want to choose the other option to preserve your original styles.
6. Decide how to handle the parent stylesheet.
In most cases, you should just leave this on the default setting, “Use the WordPress style queue.”
7. Customize your child theme’s settings.
Click the “Show/Hide Child Theme Attributes” button to display settings for your child theme’s name, website, author, author website, and description. Customize these if you would like. For example, if you are setting up a WordPress site for a client, you might want to customize the child theme’s name to match their website name.
8. Select whether you want to import menus, widgets, and customizer settings from the parent theme.
Since we are creating a new child theme, you will most likely want to do this.
9. Click the blue “Create New Child Theme” button.
This will run the configurator and actually create your new child theme.
10. Test your child theme.
Before you make your child theme live, it’s a good idea to preview it to make sure the setup process worked correctly. You can preview your theme using WordPress’ built in Live Customizer. To do this, go to Appearance > Customizer or click the link at the top of the page after you create the child theme. Scroll to your child theme and click the “Live Preview” button.
If everything looks good, click the blue “Save & Activate” button to activate your new child theme!
There you have it – an introduction to WordPress child themes, with quick and easy instructions for how to get started using them.
Child themes are essential if you plan to make major customizations to your site’s styles or files. They also improve the security of your WordPress site by allowing you to update your themes as needed, instead of fretting over whether an update will break something.
What’s your preferred method to create a WordPress child theme – manually, or using a plugin? Which plugin? Share your thoughts in the comments below.