How to Create a WordPress Child Theme?
If you work on WordPress, you can understand what is the importance of child theme while building upon a current theme. If you are a beginner at WordPress, Its good to start customizing the child theme.
Why Child Theme?
One of the most important use of the Child theme is that it will not delete the changes if the theme update releases. A child theme derives all the appearance and features of its parent theme. You can customize it without affecting the parent theme. Child Theme is the best method to customize the theme. For Example, If you made all the changes in parent theme then, you will lose all if the theme update releases.
Different methods to create a WordPress Child Theme
If you have a little knowledge of HTML, CSS, and PHP, you can easily create your own child theme.
Method 1) Creating Your First Child Theme
First, create a folder of your child theme in wp-content/themes in the root directory of your WordPress installation.
Open any text editor like Notepad and paste the following code:
/* Theme Name: Child Theme Theme URI: https://tech-banker.com/ Description: This is Twenty Seventeen Child Theme. Author: Tech Banker Author URI: https://tech-banker.com/ Template: twentyseventeen Version: 1.0 */ @import url("../twentyseventeen/style.css");
Save the file as style.css in your child theme folder you recently created. And make sure that the Template is your Parent Theme that tells which WordPress theme it should consider as the parent theme. The last line in this code imports the stylesheet of your parent theme to your child theme. In my Example, twentyseventeen is the parent theme.
- Go to Appearance » Themes.
- Here, you will see the Child Theme you have created.
Now, you can customize or modify your theme.
Method 2) Create a Child Theme Using Plugin
If you don’t want to use these steps to create a child theme, you can also use Child Theme creator plugins available in WordPress. There are various free WordPress Plugins which helps you to create a child theme.
In this article, we will discuss how to create a child theme using the One-Click Child Theme plugin.
1. Go to the Plugins Page.
2. Click on Add New.
3. In the search box type One-Click Child Theme.
4. Click on Install button and then Activate it.
5. Go to Appearance » Themes, you need to make sure that the theme you wish to create a child theme should be activated.
6. Click on the theme thumbnail which you want to create a Child Theme, then click on Child Theme.
7. This will redirect you to the Child Theme configuration page. Here, enter Theme Name, Description and Author field.
8. Click on Create Child. Now your child theme is ready to use and you can customize it as per your requirements.