Child Themes

What are Child Themes and 4 Ways to Create Them and The Advantages

Posted on

In this post, I will share experiences about child themes, how we can create them and how to use them too. If you are using a free or premium theme and you want to customize it, child themes are highly recommended in this regard.

Because some premium themes come with child themes and some of them need to be created yourself. Of course, to create a child theme is not a difficult thing, it’s easy, just follow this post completely. After that, you can create your own child theme in just a few minutes.

What is Child Theme?

A child theme is a theme that inherits the functionality and style of its parent theme. Child theme is one of the recommended ways to modify an existing theme without losing modifications when you update the theme. Child Theme is highly recommended when modifying an existing theme is Parent Theme.

For example : If you use the theme name WPBerita Themes and if you want to change the design, such as adding/removing some features, it is recommended to use a child theme. That way you can edit the parent theme code, but if your edited parent theme code is added or removed, after the theme update, all the changes will be lost.

So never edit parent theme code directly. Use child theme in such cases. If all changes are made from the child theme, you can update the parent theme and it will not affect the changes to the site. The modifications you make will remain safe.

Customizing Parent Theme via child theme

If you want to change the design or functionality of the parent theme, you can use a child theme. If you already have child themes in your premium theme plan, upload them in Appearance > Themes and enable child themes.

If the premium theme you bought does not have a child theme, of course you can create a child theme with the help of a plugin or you can create it manually as follows.

How to Make a Child Theme

If you want to create your own child theme, you can find various plugins in the WordPress repository for creating child themes. You can use any of the available plugins to create a child theme. Here, I will show you how to create child themes manually.

What you do is match the Parent Theme that you will create as a child theme. Here I decided to create a Child Theme from the default WordPress Twenty Twenty-One theme . The two files needed to create a child theme are style.css and functions.php. Here are the steps to make it:

Child Themes

1. Create a child theme folder first.

Create a Child Theme Forder First, The folder name must be the name of the parent theme– and the name of the child theme. In this case, the directory name must be twentytwentyone-child.

2. Create a style.css file

Now Create a style.css file in that folder and paste the code below into the style.css file.


Theme Name:   Twenty Twenty One Child

Theme URI:

Description:  Twenty Twenty One Child Theme

Author:       Your Name

Author URI:

Template:     twentytwentyone

Version:      1.0.0

License:      GNU General Public License v2 or later

License URI:

Tags:         blog, two-columns, right-sidebar, responsive-layout, accessibility-ready

Text Domain:  twenty-twenty-one-child


Note : The Template line matches the name of the directory of the parent theme. The parent theme in our example is twenty twenty one, so the template is twenty twenty one. At this position maybe the name of the theme you are using will be different, so adjust it. Template is the directory name of the parent theme.

Child Themes

3. Create Functions.php File

Now, it’s time to create the functions.php file. Create another file called functions.php and paste the below code in that file.


function my_theme_enqueue_styles() {
$parent_style = 'parent-style'; // This is 'twentytwentyone-style' for the Twenty Twenty One theme.
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' );

4. Child theme is now ready

Create a zip file from that child theme directory and upload the child theme in Appearance > Themes > Add New > Upload and upload the zip file and activate the theme . Make sure, the parent theme is in the directory, otherwise the child theme you created will not work.

See Also : Complete 3 Understanding of Bandwidth, Functions & How It Works Here

How to Modify Parent Theme via Child Theme?

If you want to modify the parent theme through the child theme, please follow the steps below:

  1. Create child themes. You can create your own child theme with the help of the method described above.
  2. Create the same directory path in the child theme as the parent theme has. If you want to customize the “template-parts/content.php” file , you need to create the same path in the child theme. “template-parts/content.php” and you can edit the child theme code. Just copy and save it in the child theme directory. However, once copied you are not allowed to delete the file from the parent theme, otherwise the theme will crash.
  3. If you need to edit other files, you can follow the same process as above.

Leave a Reply

Your email address will not be published. Required fields are marked *