How to Make a Child Theme in WordPress?

A Step by Step Tutorial to Create a Child Theme in WordPress

Do you want to make changes to your WordPress website? If yes, then you should create a child theme. Having a child theme in WordPress save you a lot of time and frustration. Today, I’m going to share with you a simple step by step process to create a child theme in WordPress.

What is a Child Theme?

Simply put, a child theme inherits the look and feel of the parent theme and make it easily customizable. A basic child theme includes stylesheet and a functions.php file but using a child theme you can also modify page templates of your parent theme.

Regular updates from theme developer won’t affect your modifications if you use a child theme. Also, a child theme is far easy to manage and customize than a parent theme.

However, if you want to make a lot of changes to the parent’s page template files then it might be more useful to create a custom theme altogether.

Why Should You Use a Child Theme?

There are countless benefits of using a child theme to make modifications to your site. Here are some of them:

  1. A child theme makes your modifications reusable.
  2. If you use a child theme you can update your parent theme without the worry of overriding your custom styles.
  3. It is a great way to learn about theme development if you’re a beginner.

Let’s learn how we can create a basic child theme for any parent theme you are currently using.

How to Create a Child Theme in WordPress?

There are two different ways to create a child theme in WordPress. You can either use a plugin (which is easy for beginners) or by manually creating a child theme. I would recommend the second method even if you’re a beginner. Because you will learn a lot about WordPress theme’s structure if you create a manual child theme.

Method 1: Use a Plugin to Create a Child Theme

It is a relatively simple way of creating a child theme. You will install and activate the plugin and make a few changes within the plugin interface.

Step 1: Install and activate a plugin by the name Child Theme Configurator.

Go to Tools then click on Child Themes

Step 2: Hover your mouse over Tools and select Child Themes from the drop-down menu.

Select a parent theme then click on the Analyze button

Step 3: Here, you will select a parent theme for which you want to make a child theme. I am using GeneratePress as a parent theme in this example. Click on the Analyze button.

Step 4: It will take a few seconds to load your child theme. By default, this plugin gives child theme a name. I’m not making any changes here.

Step 5: In the next option, make sure the primary stylesheet (style.css) option is selected. Select Parent Theme stylesheet handling to Use the WordPress style queue.

Keep these settings and click on Create New Child Theme

Step 6: Click on the button Create New Child Theme. Now, preview your child theme if necessary then click on the Activate button to start using this child theme.

How to Create a Manual Child Theme in WordPress?

Create a child theme folder on your computer

Create a new folder on your computer. The folder name should be clear enough to understand that it is a child theme. A best practice is to name it parentheme-child. Replace parenttheme with the actual name of your theme. For example, in my case, my parent theme name is GeneratePress. I will create a folder by the name generatepress-child.

Now we need to create 2 files, functions.php and style.css within this folder.

Create a Style.css file in your theme

Go to your text editor then create a style.css file. Now, add this code to your style.css:

/*
 Theme Name:   GeneratePress Child 
 Theme URI:    https://example.com
 Description:  GeneratePress Child Theme 
 Author:       John Doe
 Author URI:   https://example.com
 Template:     generatepress
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  generatepresschild
*/

Replace information according to your theme. Save “style.css” to your child theme’s root directory.

Note: In front of Template: type your exact parent theme name. You can find that by accessing your site via FTP. Go to wp-content/themes then look for the theme folder that you want to create a child theme for. Copy and paste the parent theme name. This is important as it will notify WordPress for which parent theme you created a child theme.

Create a Functions.php file in your theme

Now, we will create a functions.php file in the same manner. Open your text editor and name this file as functions.php. Click on the save as button and save it to your child theme’s root directory.

Now we need to load parent’s theme stylesheet to our child theme. For that we need to enter this code to our functions.php:

<?php
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' );
 
}

Make sure to save those changes. This will load your basic style.css from the parent theme.

Now we need to upload this child theme folder to our WordPress website. We can use any FTP client to access our site. Now go to wp-content/themes then upload your child theme’s folder.

After that log into your WordPress dashboard and go to Appearance then Themes. Select your child theme and click on the Live Preview button.

Your child theme should look exactly like the parent theme. Click on the Activate button and your child theme is ready. Now you can modify it as you like.

I hope you found this post useful. Let us know in the comments if you face any problem. If you want help with your WordPress site’s SEO then check out our WordPress SEO services.

Leave a Comment

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

Get Exclusive Content

Join thousands of subscribers who get free newsletter with powerful tips to drive more traffic and revenue.

You have Successfully Subscribed!