Creating Child Theme in WordPress

Only a handful of WordPress users uses a child theme and that’s because many of the users don’t know what is a child theme or Creating Child Theme in WordPress. Well, most of the people using WordPress tend to edit or customize their theme but all that customization is lost when you update your theme and that’s where the use of child theme comes. When you use a child theme then all your customization will be saved and you can easily update the parent theme.

Creating Child Theme in WordPress

Creating a Child Theme from an Unmodified Parent Theme

In order to create a child theme in WordPress you need to login to your cPanel and navigate to the public_html then wp-content/themes where you have to create a new folder for your child theme (example /Twentysixteen-child/). Make sure you don’t have any spaces in the name of child theme directory which may result in errors.

Now you need to create a style.css file for your child theme (inside the child theme directory you just created). Once you have created the file just copy and paste the following code (Change below details according to your theme specifications):

Note: The Template line (Template: twentysixteen) is to be changed according to your current name of the theme directory(the parent theme whose child we are creating). The parent theme in our example is the Twenty Sixteen theme, so the Template will be twentysixteen.

Earlier @import was used to load the stylesheet from parent to the child theme, but now it’s not a good method as it increases the amount of time to load the stylesheet. In place of using @import its best to use PHP functions in your child theme functions.php file to load the stylesheet.

In order to use functions.php file you need to create one in your child theme directory. Use the following code in your functions.php file:

Now whenever you want to make changes to your style.css or functions.php you can easily do that in your child theme without affecting the parent theme folder.

Creating Child Theme in WordPress from your parent theme, but most of you have already customized your theme then the above method is not going to help you at all. In that case, check out how to update a WordPress Theme without losing customization.

If hope this article was helpful to you but if you still have any question regarding this guide please feel free to ask them in comments.