How to create child theme in WordPress?


Why create Child Theme?

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 to parent theme because code in the child theme overwrites code in the parent theme.

Incase if your modifying the existing theme and if it has been updated, all the changes will be lost.

How to create child theme?

Login into your cpanel

Goto 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: https://vebit.com.au/
Description: Give a description for child them
Author: Author name goes here
Author URI: https://vebit.com.au/
Template: twentyeleven
Version: theme version
*/

You can change the above lines accordingly. The important lines are Theme name and Template.

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

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

To activate the child theme. Log in to your admin dashboard, and go to Appearance > Themes. You will see your child theme listed there. Click Activate

Share :
Related Posts