Child Themes and Its Importance

Let`s learn about Child themes and their Importance.

A child theme is a theme that inherits the functionality and styling of another theme, called the parent theme which inherits all the functionality, features, and code of the parent theme without making any changes to the parent theme itself.

Child themes are the recommended way of modifying an existing theme without losing the ability to upgrade that theme. If you want to add any of the functionality, design, features, etc on the theme, a child theme is the best way to do it. This allows users to change the styling of the parent theme and add/modify features without losing the ability to update the parent theme.

If all the changes are made from the child theme, you can upgrade the parent theme and it will not affect the changes on the site. Your changes will remain safe. But, if you edit the parent theme and add or remove the functionality, codes, CSS, and made the theme update, all the changes will be lost.

Basic conditions for creating a child theme
If you are going to edit codes or add codes on the theme, it is better to use the child theme, because no changes will be lost after the theme update too. If you are only going to add some CSS codes, it is not necessary to create a child theme. You can use an available plugin for Custom CSS. Conditions depend on how you feel comfortable in the above condition. If you are familiar with a child theme, it will be best to create a child theme. The premium theme usually provides a child theme with a parent theme. At that time activate the child theme and customize the theme as per your need on the child theme.

Create your own child theme
Child theme development is an easy process. Here I am going to describe to you how to create a child theme. Follow the steps and create a child theme easily within a minute.

Confirm the parent theme of which you are going to make the child theme: For example; I decided to make the child theme of the Twenty Fifteen theme. For making a child theme, the main necessary file is style.css and functions.php
Create a directory for a child theme, the directory name is parent theme directory and ‘-’ and child. For example; the parent directory of twenty fifteen themes is andtwentyfifteen the directory name of its child theme is twentyfifteen-child.
Now create a style.css in a child theme directory and write the following line of code on it.

Theme Name: Twenty Fifteen Child
Theme URI:
Description: Twenty Fifteen Child Theme
Author: John Doe
Author URI:
Template: twentyfifteen
Version: 1.0.0
License: GNU General Public License v2 or later
License URI:
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-fifteen-child

You can use the above code for the twenty fifteen child theme. If you are going to create a child theme for your own theme, copy the above similar code from parent theme style.css, located on the top of the style.css file.

Remember that, “Template” is important and never miss it. The template is the name of the parent theme directory. If your parent theme folder is “business” then you have to write the “Template: business” in the child theme.

4. Now create another file functions.php on the child theme. The only required child theme file is style.css, but functions.php is necessary to enqueue styles correctly.

function my_theme_enqueue_styles() {
$parent_style = 'parent-style';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style )
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );

5. Your child theme is created. Now ZIP the directory “twenty fifteen-child” and upload the theme from Appearance > Themes > Add News > Upload > Upload the ZIP file. Make sure, in the theme list, the parent theme should be available. Otherwise, the child theme will not function.

Override templates from the child theme

If you are trying to edit the file of a parent with child theme approach, please follow the guidelines to edit.
1. Create a child theme. (You already have it)
2. Make the same directory path as the parent theme on the child theme.
Example: If you want to edit the file which is inside the template-parts/content-single.php make the same directory path on a child theme, template-parts/content-single.php No need to add all the files inside the directory, just put the file which you are going to edit.
3. If you need to edit some other files, please follow the same process on 2.


Please share your thoughts in the comment section below: