How to create a WordPress child theme

2 Min Read

WordPress child theme is a special type of theme that works on top of its ‘parent’ theme. A child theme inherits its functionality from the main theme. Every WordPress site should use a child theme if it expects to get theme updates in future because without having a child theme, all the customizations made on a theme is lost after performing an update.

So if you want to save your theme efforts that you made to beautify the site, a child theme is required. I’ve explained what is a child theme and why it’s important in another post which you can find here. Today we will see how to create a child theme. Let’s start.

It’s very easy to create a child theme. Suppose your main theme name is ‘Eventum’. Now we will create a child theme for this. So we’ll name the child theme as ‘Eventum Child’.

At first find the directory name of the main theme. For this example, the main theme’s directory name is ‘eventum’. To start the child theme creation process, create a new folder and name it as ‘eventum-child’. Enter into the folder. Create a new empty text file inside it and edit the file name (with extension) to make it ‘style.css’.

Now open the newly created empty style.css file and paste the following code inside it.

/*
Theme Name:   Eventum Child
Theme URI:    http://yoursite.com/
Description:  Eventum Child Theme
Author:       Your Name
Author URI:   http://yoursite.com/
Template:     eventum
Version:      1.0
Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain:  eventum-child
*/

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

Understanding the fields:

Theme Name: This field will contain the name of the child theme. For our example, here we’ll put ‘Eventum Child’.

Theme URI: Here you can place your site’s address.

Description: Describe your theme in short.

Author: Your Name

Author URI: You can provide you website or profile address.

Template: Put the main theme name here. For our example, we’ll type ‘eventum’ here.

Version: Put the child theme version number here.

Tags: Type the theme related tags.

Text Domain: Type the child theme’s name in this format ‘main theme name-child’. For our example, the Text Domain field will be filled with ‘eventum-child’.

Finally paste this code and edit properly:

@import url(“../eventum/style.css”);

The red color text should be edited per your main theme’s directory name. For our example, the main theme’s directory name is ‘eventum’. So we put ‘eventum’ inside this string.

Now save the style.css file. Close the editor and zip the ‘eventum-child’ folder. Visit your WordPress admin dashboard. Install the eventum-child theme (using the zipped folder) which we’ve just created. Activate the child theme. You are all set. If you need more help in installing the child theme see this post.