Child Themes

What is child theme?

  • In WordPress we can create child theme,child theme is theme which inherits the functionality of another theme that is it’s parent theme.
  • Child theme used to modify the parent theme.
  • WordPress allows to create one or more child themes.

Use of child theme?

  • When you modify the main theme directly and if it’s get updated then there is possibility of your modification may be lost.
  • So instead of modifying  main theme directly you can create child theme of main theme and modify the child theme.
  • Using child you can preserved all your modification even if main theme gets updated.

How to create child theme?

you can create single or multiple child themes, it’s totally up to you how many child themes you want.


  1. Creating single child theme
  • Child theme mainly required one directory and two files.
  • Create one directory in themes folder,you can give any name to that directory

Example : If main theme is Divi then you can name your child theme as Divi-child which is name of your child theme directory

  • child theme must required two files,

1) style.css

2) function.php

style.css file must begin with the following code

Theme Name: Divi Child         // name of your child theme
Description: Divi Child Theme         // some description of your child theme
Author: Websitewale                      // name of author , this is optional
Author URI:      // optional
Template: divi    // name of your parent theme
Version: 1.0.0     // version of your child theme

-The final step is to enqueue the parent and child theme stylesheets which will be done in function.php

-Open function.php of child theme to enqueue all the stylesheets of parent theme.

add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
function my_theme_enqueue_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );


  • Above code will enqueue style.css from parent theme to child theme.
  • If your child theme style.css contains actual CSS code, you will need to enqueue it as well.
  1. Creating multiple child themes
  • To creating multiple child themes you have to create multiple directories and files in themes folder
  • Suppose if you want to create four child themes of  Divi theme then create four new folders in themes folder and name them Divi-child-1, Divi-child-2, Divi-child-3, Divi-child-4 respectively .
  • Create style.css and function.php in each folder as these two files must required .
  • But if  you make  modification related to functionality in function.php in one child themes then each time you have to make those changes in each function.php of every child themes.
  • remaining steps are same as creating single child theme except you have to add above code in each style.css  and function.php

how to activate child theme?

  • After successfully creating all directories and files you can activate your child themes from admin dashboard.
  • First login to admin dashboard of your website.
  • now on the left hand side of your screen you can see Appearance option under that click on themes option.
  • Then you will see new window containing main theme as well as all child themes you have  created.
  • click on activate button of theme which you want to currently apply to your website.

Join Newsletter.

Continue Reading

Leave A Comment