Ever since WordPress came to the market in 2003 it has been evolving continuously as per the demand and requirements in the market. No doubt it is the best CMS available to build any kind of website. When we finally decide to develop and run a WordPress Website then some of the developers ask a question – “What are the benefits of creating a WordPress child Theme for websites?”. This just shows that still so many people do not know how to create two different versions of their website. But nevertheless it is very important to create a parent and a child theme for a particular website.
It has been seen that most of the people who want a WordPress blog or site and go for WordPress Theme Development choose to use the default themes that WordPress offers but this may not be the best option all the time. Some of the best WordPress themes have minimum functionality and features and limited customization options. Actually, the best WordPress themes are those which are customizable and you may need them to build your website.
What is a Child Theme?
Benefits of Creating a WordPress Child Theme
If you create a child theme, then it will speed up the development process of your WordPress blog or site. It is quite easy to learn as most of the WordPress themes allow setting up a theme even for beginners.
Not losing Changes
Most of the times, when you update a WordPress theme, any changes or customization which you have made to your website are lost. But if you have created a WordPress child theme then it will not happen as you can customize the child theme and then update the parent theme. In this way, all the updates and new features will automatically be applied to the child theme and its customization too will not be affected.
Can Accommodate Mistakes
When you are creating a complete theme, you also need to think about all the possible scenarios and code for them. But when you are working on a child theme and if you forget to code for something then there is always the parent’s theme’s functionality available as the working option.
Creating a WordPress Child Theme
Now you know what a Child Theme is and what are its benefits. Now let’s create one. There are few things which are required to have a child theme: -
First of all, create a new directory in your themes directory to hold the child theme. The theme directory is wp-content/themes. You should name the directory without any space and use the name of the parent theme folder with “-child” appended to it. For example, if you are making a child of the twentyeleven theme, your folder name would be twentyeleven-child.
After that, in the child theme directory, create a file called style.css. This is the only file required to make a child theme and the style sheet must start with the following lines: -
Theme Name: Twenty Eleven Child
Theme URI: http://example.com/twenty-eleven-child/
Description: Twenty Eleven Child Theme
Author URI: http://example.com
Template: Twenty Eleven
/* =Theme customization starts here
Now you can change the above lines to suit your theme. The only needed lines are the Theme Name and the Template. The Template is the directory name of the parent theme. In this example, the parent theme is the TwentyElevan theme, so the Template is twentyeleven which is the name of the directory where the TwentyEleven theme is placed.
The child theme’s stylesheet is included after the parent theme’s and styles will override those in the parent theme’s stylesheet.
Now activate the child theme, log into your website’s dashboard and go to the Administration Panels > Appearance > Themes. Here you will see your child theme. After that just click on the Activate button.
We have just discussed what is a child theme in WordPress, what are its benefits and how it can be created. No doubt creating a WordPress child theme has many benefits for your WordPress site or blog but if you don’t require too many changes to your original website then you may not need the child theme. Hence based on your custom requirements, choose the way which best suits you i.e. whether to build a child theme for your WordPress website or not. Hence do your research properly in this regard.