How to Create Child Theme in WordPress

Using child theme is the easiest way to modify/customize your WordPress theme without editing your original theme. Let's discuss about How to Create Child Theme in WordPress, how it works and why you should use a child theme.

Updated on

In this guide, I will discuss about How to Create Child Theme in WordPress. Will also learn How WordPress Child Theme works and Why you should use a Child Theme in WordPress. You might know that using child theme is the most easiest and recommended way to modify/customize your WordPress theme without editing your original theme files. I will share two methods to Create Child Theme. First one would required some coding and manual work. And In second method I’ll share two most reliable Child Theme Plugin for WordPress.

How to Create Child Theme in WordPress
How to Create Child Theme in WordPress

What is a Child Theme

First of all, you should understand what is a Child theme?

Child theme is a separate customized theme along with the functionality of parent theme. When I say customized theme, that means you can build a customized theme based on an existing theme. Add new styles or change functionalities as per your requirement without losing or editing the core files of parent theme.

How Child Theme Works in WordPress

When you create a child theme and activate it, WordPress first check the child theme for styles and functionality. If WordPress did not find the necessary theme files in child theme, than it look into the parent theme for necessary files.

Suppose, if your child theme has a customized “index.php” file, WordPress will use the same instead of using “index.php” form parent theme.

And if “index.php” file did not exist in the child theme folder, WordPress will use the file from parent theme folder.

Isn’t this the great functionality? You only need to customize what you want.

Why You Should Use a Child Theme in WordPress

Every individual like you and me, who own a website, treats it as a valuable asset. And for most of us, blogging is one of our source of income, you can correct me if I am wrong.

We always wanted to have the flexibility to build our website as per our requirement and choice. Child theme gives us that freedom without compromising the risk of losing parent theme functionality and security.

Furthermore, There are few reasons why you should use a child theme,

You can customize your parent theme directly, but when you update your theme, all customization will be lost.

Even if you want to customize small piece of code, I recommend you to use a child theme. As it gives you the freedom to update you theme without losing your customized code.

And secondly, as you are not going to mess-up with the core theme files by using a child theme. At any time, you can go back to parent theme without any hesitation.

In this Modern age, technologies are emerging day by day and so does increasing the risk of using technology. WordPress releases new versions in every six months with improved functionality, fixing of bugs and with more security.

So, our website theme should also be aligned with new version of WordPress. And that is why theme development companies or individuals releases required theme updates with new security patches and functionalities.

Therefore, You should update your theme and plugins on regular basis to avoid WordPress compatibility errors and because you are using a child theme, your current design and functionality will be the same.

How to Create Child Theme in WordPress

Here, I will share two commonly used methods to Create Child Theme in WordPress. One without plugin and one with plugin.

Method #1

Create Child Theme in WordPress without plugin

In order to Create Child Theme in WordPress without plugin, you only need to create two files i.e. style.css and  functions.php in Child theme directory/folder.

  1. Create a new theme folder in your themes directory “/wp-content/themes”. And rename it i.e. motive-child (your_parent_theme_name-child; replace your_parent_theme_name with your parent theme name. In this example parent theme name is motive).
  2. Create a new stylesheet in the child theme folder (i.e. motive-child) and rename it to css. Copy and paste following code in style.css file.
/*--------------------
Theme Name: Motive Child
Theme URI: https://your-domain.com/motive-child/
Description: Motive Child Theme
Author: Johnson
Author URI: https://abc-domain.com
Template: motive
Version: 0.6
Tags: single-columns, red, black, responsive
--------------------*/

/*-------------------- custom css below --------------------*/

You do not need to write all the details mentioned in the above given code, WordPress only requires Theme Name (name of your child theme) and Template (name of your parent theme). Description, Author, Version, Tags are optional you can add or skip these details, it is up to you.

  1. Finally you need to call the stylesheet and other files of your parent theme, so create a new file in the child theme folder (i.e. motive-child) and rename it to functions.php
  2. Now call the parent theme stylesheet in your child theme by using the following code in functions.php
<?php
//
function tn_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}

add_action ( 'wp_enqueue_scripts', 'tn_theme_enqueue_styles' );

//
// Your code goes below
//
Child Theme Style.css file
Child Theme Style.css file

And you are done. You have successfully created a child theme. Go to the WordPress dashboard, look for Appearance>Themes and you will find your new child theme “motive-child”. Activate it and check, it should work properly.

Child Theme in WP Dashboard
Child Theme in WP Dashboard

You will notice that your child theme does not appear with a screenshot in the theme panel (Appearance>Themes) but your original theme does have a sample screenshot. You can also add any image or your websites screenshot into your child theme. Upload an image or screenshot in child theme folder (i.e. motive-child) and rename it to “screenshot.png”, now your child theme will also appear with your uploaded image.

Now you can customize most of the files of your parent theme, i.e. header.php, footer.php, single.php, sidebar.php, index.php, loop.php, includes/authorbox.php etc. by copying the parent theme file in child theme folder.

Just copy and paste the original theme file i.e. single.php into your child theme folder and customize it as per your need. Make sure you are using the right path, if you want to customize authorbox.php and this file exist in a separate folder i.e. includes/authorbox.php in parent theme folder, you need to create the same folder in child theme folder and copy the original file.

Method #2

Child Theme Plugin – Create Child Theme in WordPress with Plugin

If you are a beginner, I would recommend you to use a WordPress plugin to avoid errors. There are plenty of Child Theme plugins available on WordPress, I would recommend you to use plugin called One-Click Child Theme.

This tiny Child Theme Plugin is really simple and easy to use. It Create Child Theme in WordPress in just one click. It can also copy other parent theme files in one click only. And it also have the functionality to capture a screenshot of your website and set it as your child theme image. See how it works in the below given pictures.

Your step by step guide to Create Child Theme in WordPress with Plugin
  • Install and activate One-Click Child Theme WordPress Plugin from WP Repository.
  • Go the the Dashboard > Appearance > Child Theme.
  • Now enter your child theme name, enter description, author name and click on the Create Child button. See below image for steps.
One-Click Child Theme Plugin
One-Click Child Theme Plugin
  • Plugin will create a child theme, activate it and redirect you to themes panel as show in the below given image. It will also display a message that “Theme switched! Click here to edit the child stylesheet.”
Create Child Theme with WordPress Plugin
Create Child Theme with WordPress Plugin

There is another popular Child Theme Plugin called WP Child Theme Generator is available on WordPress Plugin Directory for free. You can give that a try too.

Hope you like this guide, don’t forget to share it and let us know your feedback in the comments section below. Have a great day and good luck with your child theme and WordPress customization.

Read More about WordPress Development Techniques:
How to Display Excerpt in WordPress Front Page
How to Limit Excerpt Length in WordPress
Insert Tables in WordPress using a Plugin
Remove Google Fonts form WordPress Theme
How to Remove Font Awesome from WordPress Theme

Photo of author
Saurabh K
Saurabh K is a technology enthusiast and part-time blogger. He loves to explore the efficient use of technology and gadgets. He is an outlier and lensman. Add him in your social circle to know more.
Disclaimer: Affiliate links of some product(s) are being used on this page, if you follow the link and make a purchase, we may receive compensation from respective companies. This compensation comes at no additional cost to you.

6 thoughts on “How to Create Child Theme in WordPress”

  1. Avatar of Narendra

    Very brilliantly explained. I hope it will help me to get blog of my desire. Thanks Saurabh K.

    Reply
  2. Avatar of Ray Boller

    Thanks for the instructions. It helped me to create child template.

    Reply
  3. Avatar of Robina

    I have added the code but it’s not working

    Reply
    • Avatar of Saurabh K

      You can use the plugin instead.

      Reply
  4. Avatar of jak

    I successfully set-up the child theme as you described. Much obliged.

    Question: If I need to modify the code in other files of the parent (comments section for WordPress, for instance), do I just copy the original parent file, put it in the child folder, and then add the additional code to it? Or, do I have to modify it differently like you did with the style and functions files?

    If you have a blog about this, then I’d welcome reading it. Ultimately, I’d like to add those little check boxes that you have below the comments section too (without using a plugin).

    Reply
    • Avatar of Saurabh K

      It’s great to see that you find the information useful.
      I would not advise you to edit any file in the parent theme folder. Instead, you should create a copy of the file in the child theme folder before you edit it.

      Reply

Leave a Comment

Your email address and website details will not be published. Required fields are marked with *.