WordPress Child Theme is a very important part of WordPress. It lets you modify your theme as per your requirement without fearing of loosing updates when the theme gets updated.
An example will make it more clear.
Let’s say you like a WordPress theme for your website. But you feel some limitation in its features. So, you manually make changes in WordPress theme files i.e. php files as per your need. Wow! everything works fine.
After some time, the theme author updates the theme and then, you loose all your changes as the new files gets “overwritten” in your server. So, now, you’ve to make all those changes again in php files, if you remember.
The solution is to make a small duplicate copy of original theme – called “WordPress Child theme” and make changes in new theme. If the original theme gets updated – called “parent theme”, your child theme will remain untouched.
Let’s implement all this with real example.
At the time of writing this article, I’m using WordPress Mesocolumn theme – a free, responsive yet full of features which you won’t find even in some premium paid themes. But I need to make changes in its CSS and functions files. So, I followed these steps to make a WordPress child theme.
First, using your FTP client software, go to your themes folder. It’s under /public_html/wp-content/
Make a folder with the name of your new theme. My original parent theme folder is mesocolumn, so I made another folder with the name mesocolumn-child.
Now, using your text-editor software, make a text file with the name style.css and upload it inside child theme folder.
The content of this style.css is very important because it links your child theme with parent theme. Here is the sample code of my child theme’s style.css
Theme Name: mesocolumn child theme
Description: This is a custom child theme I have created.
Author: My Name
Theme URL: https://zwordpress.com/
2 points to take care of.
Firstly, Template name should be the folder name of your parent theme. In our case, it was mesocolumn.
Secondly, @import line links your child theme with parent theme style.css
Now, goto Dashboard -> Appearance and you’ll see your newly created child theme, with the name mesocolumn-child. just activate it.
From now-onwards, if you want to make any changes in your theme files, you can do that without fearing of loosing them.
If you want to make any changes in original theme php files, just copy the original file to your child’s theme folder and make changes there.