A WordPress child theme is a type of WordPress theme that gets its functionality from the parent WordPress theme. A child theme is frequently used when you would like to tweak or customize an existing WordPress theme but still want to be able to upgrade the theme as needed. There wasn’t any easy way in the past to update WordPress themes without losing all of your changes and custom styling. That can turn into a chaotic situation when suddenly you find there is a major exploit in a script that is commonly used on popular themes, and your themes need to be updated as soon as possible. It is a difficult choice to make since one on hand if you update you lose all of your custom styles. On the other hand, if you don’t update quickly enough you risk your website getting hacked.
The community and core team made the decision to solve the problem through introducing the parent and child theme concept. A WordPress child theme inherits all of the parent theme’s code, features, and functionality without having to make changes to the actual parent theme. That allows users to change the parent theme’s styling and modifying or adding features without losing the ability to make updates to the parent theme.
In theory, all WordPress themes can also have child themes. However, not every WordPress theme make good parent themes. If a parent theme has limited features and functionality, in most cases it isn’t going to be an ideal candidate as a parent theme. Later in the article, we will discuss the exceptions.
Usually, a great parent theme, which is also referred to as a theme framework, contains its own filters and action hooks. This enables developers and designers to use child themes to create very robust custom WordPress websites much faster.
Why WordPress Child Themes are used
Child themes are used by developers and designers to speed their development process up. When a good parent theme is used, you can significantly reduce the amount of time that it takes to get a WordPress website created. All great parent themes, or theme frameworks, provide tons of customization options and functionality, so everything doesn’t have to be coded. DIY users frequently create child themes in order to make tweaks to an existing WordPress theme but still be able to update the parent theme when necessary.
To create a WordPress child theme, it may be as simple as getting a new style.css file created and placing it into a new folder. All that is needed is one line placed into your new style.css header to define the template (for reference, see the Codex). A robust child theme might have as many template files that the parent them has or even more. In some cases, a child theme might have template files that the parent theme doesn’t have.
When A Child Theme Should Be Used
The decision for using a child theme frequently depends on what your needs are. Most of the websites that we build for our clients and ourselves are child themes from the Genesis theme framework. We will create a custom standalone WordPress theme in those rare situations where a project is too simple or too complex. As WordPress developers, it is important for us to streamline our workflow as we are creating quality themes. We are able to accomplish exactly that by creating child themes with the Genesis framework.
For users, we only recommend child themes if you find yourself having to constantly add new functions to the functions.php file of your theme and/or you are constantly having to add to or modify your theme’s style.css file. In those situations, we highly recommend using a child theme. Recently during our WordPress meetup discussion, a member asked us what if only custom styles are being added? In that case, is it better using a custom CSS plug or a child theme?
The answer to this question depends on how comfortable and savvy you are using technology. If you are just modifying the styles of a couple of element, then it works just fine to use a custom CSS plugin. However, if you need to move things around in CSS, change the entire color scheme, then definitely you should think about using a child theme.
It Is Very Important To Choose A Good Parent Theme
Every WordPress framework is a parent theme. However, not every parent theme is a framework. This cannot be stressed enough. Although any WordPress theme may have child themes, they are not all intended to be used as a theme framework. One common mistake that we have seen many beginners make is to create a child theme from a parent theme that doesn’t provide a lot of functionality.
If you are going to create a child theme and you have to replace many parent theme files, you should consider rethinking your process. As an example, if the Twenty Eleven theme really appeals to you, and you have decided to make a child theme. Your child theme has the functions.php file and style.css file. In addition, you don’t like the footer appearance, so you have added a footer.php file. The same thing for the header, etc. In this situation, then you should use the Twenty Eleven theme as your parent theme. Instead, you should use a starter theme that can be turned into your very own custom theme.
There are several users that have created custom child themes that should really have been completely independent custom themes since they overridden nearly all the parent’s theme files.
Briefly putting, a child theme should be used when you need the features and functionality of a powerful and awesome parent them without having to write a lot of your own code.
Advantages to Using WordPress Child Themes
Using a WordPress Child theme has both advantages and disadvantages to it. Let’s first look at the advantages.
1. Safe Updates
A parent theme’s templates, styles, and features are automatically inherited by a child theme. This enables you to use child themes to make changes to your website without having to modify the parent theme. Whenever a new version of your parent theme is released, you can update safely since all of your modifications get saved to your child theme as well.
2. Easily Extended
A child theme that has been built from a powerful theme framework gives you a lot of flexibility without having to write lots of code. It allows you to selectively modify just the template functions and files that you need to without having to go through the other template files. New functionality can be added and more.
3. Safe Fallback Option
When creating an entire theme, you have to consider all of the potential scenarios and the code for these. However, if there is something that you forget to code when using a child theme, you always have the functionality of the parent them to fall back on.
Disadvantages to Using Child Themes
When using a child theme, one of the major disadvantages is the amount of time that needs to be invested in becoming familiar with the parent theme Especially when working with a robust framework, there is a substantial learning curve since they each have their own filters and hooks. You need to know how to maximize their potential. However, we believe the learning curve is just a one-time thing. For instance, the first couple of child themes you create may take you longer, however, you will then be able to create custom website much faster after that. Your performance overall will continue to improve.
Another disadvantage that is frequently pointed out is the developers of the parent theme might lose interest in it and abandon it, introduce a new change that completely ruins your child theme, or drops an important feature that your child theme uses. That actually isn’t as bad as it might sound. That is mostly due to the fact that all great WordPress themes are GPL and open source. If the developer of a parent theme abandons the project, you aren’t forced to stop using it. Frequently, other people in the community will step in and take a project over. If a certain feature is removed by the original theme developers, it can be added to your child them. You will have the code to use. Finally, if any drastic changes are made that you don’t like, you can choose not to update. However, theme updates are critical whenever a security exploit exists. We always recommend that themes be updates by users since it helps to ensure compatibility in the future with other plugins and scripts.
If you use a commercial theme framework such as Genesis, a support option will be available to you to help you with troubleshooting problems or upgrading your theme. In addition, robust platforms like Genesis are not going to just disappear since it is a stable business that has thousands of customers all over the world. For example, certain built-in widgets were removed, but Genesis made them available as plugins for users who still wanted them.
It is very important to be aware that although a child theme can always be created from any WordPress theme, there are times when a child theme is not needed. Consider how many changes you are planning for a child theme. If they are minor changes, then a custom-style.css file can always be created for your them or a Custom CSS plugin can be used. If the changes are extensive to the point where you are overriding the core theme files of the parent theme, then you should probably create a custom theme instead.
Hopefully, this article has helped you understand WordPress Child Themes better and has provided you with the information you need to decide whether they are a good fit for your project.