Suppose you make a website for your interest or business. Now, you select a theme for your website i.e. how your website will look and all. So, you see several options and choose a theme that suits best to your goals and interest. But you want to make a few changes to make it look more according to what you have in mind. Then, you can create a child theme of it and customize the child theme without making a change in the actual ‘parent theme’.
Technically, a child theme is like a copy of the parent theme. It has all the functionality and styling of the parent theme and is generally created to make a few styling changes in the parent theme while keeping the actual parent theme template unchanged.
What is a parent theme?
A parent theme has all the WordPress template files and assets required for the theme to work. In short, a parent theme is independent of any other theme and has a collection of all the assets and files required to display a theme. Originally WordPress had just the parent theme but later with time, came the feature of creating a child theme to make it easy for a user or developer to make some small changes in the parent theme.
Also the term ‘parent theme’ was coined after the child theme’s idea came into action.
What is a child theme?
A parent theme is independent of any other theme but a child theme is not. As per the name, a child theme is a copy of the parent theme and doesn’t contain all the files and therefore is dependent on the parent theme to work. The child theme was not originally present in WordPress, but it was added later to help users or developers customize the parent theme easily. A child theme generally has two files – ‘style.css and functions.php’.
You can customize the child theme, make changes in style.css or functions.php files according to your needs and interest and your parent theme will remain unchanged. This helps developers and designers to customize the theme and still retain the original theme template.
Use of a child theme in WordPress
A child theme is created to make changes in small aspects of the parent theme while keeping the original parent theme template unchanged. Basically, a child theme is used to customize the styling or add functions in the parent theme and at the same time keep the actual parent theme template unedited.
However, everything has some advantages and disadvantages and so does the child theme. Let’s have a deeper look at the pros and cons of a child theme:
Pros of a Child Theme
You can change the styling of a parent theme without changing the actual parent theme template. You can create a child theme and then customize that according to your needs and interest. It helps you make small changes in the parent theme easily and also retain the original theme as unchanged or unedited.
✓ Changes Saved
You will not lose your customizations if you update the parent theme as they are now saved in the child theme. Earlier, when we used to update the parent theme all our customizations would vanish. So, no more worrying about losing changes in case you update the parent theme.
✓ Good for beginners
If you are a developer and learning to create WordPress themes, then child theme can help you save your time and learn stuff easily as it doesn’t contain tons of files but has only two files. This makes your work easy. Also as the child theme doesn’t have many files, it helps in debugging process as you don’t have to search much.
Cons of a Child Theme
You will have to learn the parent theme first to work on the child theme and that often requires a lot of time. So it’s not a one-day task and it will require a lot of time investment. However, once you learn the parent theme and its functionality, the rest of the process becomes easy for you.
With some themes, the problem is if the parent theme is dropped by the developer or a feature is removed, it will affect the child theme as well. However, if your theme is open source, you can continue to work on it even after the parent theme is dropped by the developer.
Difference between Parent and Child theme
➜ A parent theme is independent of any other theme for working while a child theme is dependent on the parent theme to work.
➜ A parent theme contains all the files and templates required for the theme to work. However, that’s not the case with the child theme. Child theme doesn’t contain all the files, it just has two files – style.css and functions.php
➜ A child theme can save you from losing your customizations even if you update the parent theme as all the customizations are stored in the child theme and you can view or edit them there.
The main idea behind creating the child theme was to ease the modification process in the main theme. So, if you are happy and satisfied with your current theme and are not looking to modify it in any way, then there seems no need to spend time on creating and altering the child theme.
But if you want to modify your theme’s style.css or functions.php file or you feel the need to make changes in every few days, then you can consider creating a child theme. It will save your time and make the modification process easy for you. Also, if you are a developer, a child theme can help you learn a lot of stuff with ease and rescue development time for you.