How to create child theme in WordPress?

Why use child theme in WordPress?

Child theme is a theme that inherits the functionality of parent theme. It is important to create child theme, so that it inherits the css from parent theme, which allows you to make changes without affecting the parent theme’s code.

If your not setting up child theme and working directly on parent theme, any theme update would overwrite all your custom code.

So it is always recommended to create a child theme before you start any WordPress website or a blog.

How to create child theme?

Login into your cpanel

Go to wp-content -> themes

For instance lets take twentyeleven as main parent theme.

Now create a directory/folder to hold your child theme and it’s important you name it as “twentyeleven-child”

With in the twentyeleven-child folder create a file and name it as “style.css” and add the following lines:

Theme Name: Twenty Eleven Child
Theme URI:
Description: Give a description for child them
Author: Author name goes here
Author URI:
Template: twentyeleven
Version: 1.0.1

You can change the above lines accordingly. The important lines are "Template:" and @import sections

To overwrite the parent theme’s stylesheet, you need to start the stylesheet with the following line:

@import url("../twentyeleven/style.css");

Activating Your Child Theme

To activate the child theme. Log in to your WordPress dashboard, and navigate to Appearance > Themes.

You will see your child theme listed there. Click Activate

Related Posts