when to use child themes in wordpress and its advantages and disadvantages
A WordPress Child Theme is a theme that inherits the functionality and look and feel of another WordPress Theme, which is referred to as the Parent Theme. The Child theme then have the ability to extend and override the functionality of the parent theme.
Using a child theme is the recommended process for modifying an existing theme. It is easiest and recommended way to customize a theme further while still maintaining most of the original features of the theme. This gives several distinct advantages in maintaining the themes.
When to use Child Themes
Child themes can be used in different scenarios. We will look at some common use cases when it makes most sense.
Third-party Parent Theme: Let's say you want to use a third-party theme that you have purchased. There might be some modifications that you want to make to the theme to make work well for you. These changes might be specific to your site and pretty localized to the site.
Common Parent Theme: If you develop and maintain several websites, then you might be using several different themes. It is easier and faster to have a common parent theme with the common and basic functionality that you can extend and customize further.
Scope of Changes: This is one of the most challenging parts to know ahead of time. If you find that the changes are extremely minor, such as just a few CSS changes then you could probably get away by using a WordPress Plugin. Same goes for functionality changes as well as most might be achievable using a plugin. The rule of thumb is if you find making changes to the theme files, then you need a child theme.
There are several advantages in using a child theme over modifying the parent theme.
Advantages of Child Themes
Updates: If there are updates to the parent theme that you want to apply, then it is quite possible that the modifications you made to the parent theme will be overwritten. Using a child theme will protect the modifications that you made, even while the parent theme is updated.
Faster Development: It is easier and faster to develop a new theme or modify the existing theme. You do not have to re-implement the basic and common functionality and can just concentrate on the part that needs to be changed.
Ease of Development: Again it is much easier to just deal with the parts that you need to modify rather than getting bogged down by the entire file or source code. You can selectively focus on the appropriate methods, templates or the style sheets.
Disadvantages of Child Themes
Unintended Changes: If you happened to extend any of the custom features in the parent theme, then there is a possibility that your changes might be broken on a subsequent update of the parent theme. Sometimes, the themes have not been designed and implemented with child themes in consideration which makes it harder for it to be extended.
Lack of Updates: Choosing the right theme to extend is crucial. It is quite possible that active development of the parent theme might cease and the theme is abandoned. It is also possible that the parent theme is not updated regularly with latest WordPress versions and security updates.
Learning Curve: Although one of the advantages of child themes is that you have easier and faster development, it is very much dependent on the framework and theme itself. If the theme does not adhere to the standards and common coding practices, it could increase the learning time.
Advantages and disadvantages above are pretty generic and based on common use cases. It can be different based on your requirements. Some advantages can be disadvantages in your specific scenario, so you need to carefully evaluate the pros and cons in the context of your requirements. There are a couple of important things that you need to consider when using child themes.
Do you really need a child theme? If your changes are minor, then you might be able to get away with plugins or just using the options in the theme. If your changes are extensive and spread over a large number of files, then you might be better off creating your own theme.
Is this the right parent theme? Choosing the right parent theme is crucial. It should provide most of the required functions right out of the box, otherwise you will be customizing and overriding way too much. You should also make sure that the theme has the potential to stay around for a long period of time or at least as long as you plan to use it. It should also provide periodic updates, especially security updates.