Child themes are a great way to incorporate customizations on your WordPress website while working within a parent theme framework.
Another benefit is that child themes will enable you to perform customizations without worrying that something will break once the parent theme is updated.
Most of the free and premium WordPress themes come with many customization options, but sometimes you need to change or add code for customizations.
For example, if you do manual customizations on theme files – they’ll likely be overwritten or corrupted once the theme is updated.
If you lose your customizations, you lose what makes your website special.
Keep in mind that child themes are contingent on a parent theme/theme framework and can’t work without them.
They use all the parent theme features and appearance without any changes to the parent theme code.
In most cases, child themes are used in conjunction with WordPress theme frameworks, which are essentially robust parent themes that provide a solid foundation for theme developers to work on.
How to install a WordPress child theme
Installing a WordPress child theme is the same as installing any other WordPress theme. Head to your WordPress Dashboard > Appearance > Themes, and click Add New:
There are two ways to install a child theme on your WordPress website:
Automatically
If the theme is available on the WordPress Themes website, you can look it up via the search field in the top-right corner of your WordPress dashboard:
Hover your mouse over the theme thumbnail, and click Install to install the theme on your website.
WordPress will automatically download and install your child theme. It will search for the parent theme on the WordPress.org theme directory and automatically install the parent theme as well if it’s available there.
Manual
If the theme you’d like to use doesn’t exist as a free theme on WordPress.org, then you need to purchase the theme and download the theme’s .zip file to your computer.
Head to your WordPress Dashboard > Appearance > Themes > Add New and click Upload Theme:
Click Browse, navigate to your theme .zip file on your computer, and click Install Now:
WordPress will upload your theme file and install it on your website. It will automatically check if the parent theme is installed and if it’s available on WordPress.org – it will install it as well:
If the parent theme is not available on WordPress.org – it will ask you to install the .zip file separately using the same method.
How to install a WordPress parent theme
As explained previously, if the parent theme doesn’t exist as a free theme in the WordPress theme directory – WordPress won’t be able to install it for you, and you won’t be able to activate your child theme:
If you check your themes page – it will show as a broken theme:
To fix this, make sure to go to your parent theme’s website and download the ZIP file. Perform the same steps mentioned above, and install the theme ZIP file from your WordPress Dashboard > Appearance > Themes > Add New > Upload Theme > select the ZIP file on your computer and click Install Now.
Once both parent and child themes are installed on your WordPress – you’ll be able to activate your child theme.
Keep in mind that you don’t need to activate the parent theme to use its child theme.
How to get the most out of your child theme
Once you have a fully activated child theme, you can go ahead and customize it and play around with its available options.
Here are some tips:
Create custom page templates
When you create a new page in WordPress, you can choose the template you want to use. These are full-width layouts and sidebar layouts most often. We recommend learning how to add new layouts through your child theme as it can be pretty valuable.
Create custom styles
As we mentioned previously, the child theme automatically inherits the parent theme’s style and features. However, it also has its own style.css file, which you can use to override the parent theme. Adjusting the style using CSS is quite simple, and all you need to know is the name of the element.
We recommend using your browser developer tools such as Chrome DevTools to find the names of specific elements on your page by using the Inspect tool. Using those tools allows you to adjust your child theme style.css as required.
Override parent theme files
Same as with the style.css file – every parent theme file can be overwritten as well. For example, if your parent theme has a footer.php file – adding a footer.php file with a different code in your child theme folder will automatically force WordPress to use it.
As long as both files share the same folder tree structure and have the same name – WordPress will automatically prefer to load the child theme file.
Create theme hooks
In WordPress, hooks are triggers that allow you to adjust how your files work or add custom code when an event is triggered. Hooks are handy, but it can take some time to learn how to use them and we won’t go super in-depth in this particular article.
However, if you know how to use them, you can add hooks to your child theme using the functions.php file, so your customizations are independent of your parent theme.
Final words
WordPress child themes can be a bit scary to use at first, but we recommend digging in and learning more about them as they provide additional flexibility and security.
If your WordPress theme is frequently updated or you need to make frequent changes, a child theme will save you time and keep your website intact.