How To Create A Child Theme of Any WordPress Theme?
September 10th, 2016 | by Ravi Chahar || 18 Comments |
Are you a blogger and want to become a developer? Do you want to create a child theme of your current WordPress theme? Do you know how to create a child theme?
In this post, I will provide the basic idea to develop a WordPress child theme. You would come to know the importance and the usage.
There is always an issue when you customize your WordPress theme and want to upgrade it to its latest version. You should know that you can update WordPress theme manually.
A Child theme can also help you in that. You can create a child theme to customize your parent theme which would let you update the parent theme easily.
How To Create A Child Theme Within A Few Minutes?
Though to start developing a WordPreess child theme of any parent theme, it would take a few minutes but the customization may take the time.
It is dependent on the choice you make to design your theme. The benefit of creating a WordPress theme is that you can easily customize the parent theme.
It would give you the freedom to update without any cPanel or FTP usage. Whenever you want to add any extra code to display something to your website, you can add that in the child theme.
You won’t need to build a WordPress theme from scratch. As this website is running on the BloggingLove Theme which was created from the scratch.
You won’t need to work so hard. You just have to connect the files of the parent theme to your child theme.
Connect The CSS File To Create A Child Theme.
It would be good if you install WordPress on Xampp server or any other local like to break your main theme.
There are some steps after that.
Step 1:- Open the WordPress folder present on the local server. If you want to create a child theme on an online server then you just have to login to the cPanel and open the “public_HTML” directory.
Step 2:- Search for the “wp-content” folder and then “themes” folder.
Step 3:- Create a new folder with the name of your child theme.
Step 4:- After adding that folder, open it and create a new file using the Notepad or any other text editor. You have to add a few lines about this child theme.
/*Theme Name: Child Theme Name
Theme URI: http://www.yourdomain.com
Description: Child Theme of Parent Theme Name
Author: Your Name
Author URI: http://www.yourdomain.com
Template: Parent Theme Name
Step 5:- After adding these details, you have to save this file as “style.css“. It’s because when you create a child theme of your parent theme then you import the main CSS file.
NOTE: Make sure that you don’t miswrite the name of the parent theme. It is case sensitive. If it is written as “BloggingLove” then you can’t write it as “blogginglove”. You have to copy and paste it as it is.
Step 6:- If you want to change the design of the parent theme then you can use the style.css file of your child theme. You can edit all the WordPress theme file structure just by adding those files in the new folder you have created for the child theme.
After that, edit the files. For example, if you want to add a few theme support options then you can copy the functions.php file of the parent theme and paste it in the child theme folder.
Edit it and add the codes in the functions.php. You can do that with any file. There would be no effect on the parent theme files.
How Can You Use The Child Theme To Customize Your Parent Theme?
The main requirement is the knowledge of the HTML and CSS. If you know the CSS classes and IDs then you can easily modify every section of the theme.
For which, you can use the “inspect element” option available in many browsers. If you are using Google Chrome or Opera then just right-click on the part of the theme you want to customize and choose the “inspect element” option and you can easily see the HTML structure and the classes.
You can directly target any of the parts of the parent theme using the style.css file. CSS is an amazing language and you have fun with it.
Now, you can modify your website the way you want. Basically, you have added a child theme to your website. But the customization is in your mind, do it by targeting the parent theme elements.
Are You Ready To Create A Child Them For Your Website?
You don’t need to change the theme if you can modify it. If you are a beginner in the web development field then it would be a great start for you.
It’s because, you won’t need to create all the theme files, just use the original files to customize your website’s theme.
Create a child theme which can give a new look to your blog and drive traffic to your blog. If you face any problem then feel free to ask.