How to create a child theme in WordPress

Create a Child Theme for your WordPress Website: 3 Different Methods

Do you want to create a child theme for your WordPress site? If you’ve found a great theme that you want to use (whether you intend on modifying it or not), you should absolutely create and use a child theme.

This lets you make any customizations, and not lose them when the theme is upated. In this guide, you will learn about why using a child theme is important and how to easily create and edit one.

If you’re looking for quality shared hosting for your WordPress website, we highly recommend A2 Hosting. They offer unlimited SSD space, free automatic site backups, hosting optimized for speed and 24/7/365 guru technical support.

Why using a WordPress child theme is important

A child theme inherits all the characteristics of a parent theme, which makes it easy for you to customize any code while leaving the parent theme’s functionality intact. When the parent theme gets updated, your code customizations will not be overwritten, and any changes you’ve made will remain.

In addition, using a child theme lets you easily track any edits you’ve made. Since the files of a child theme are separate from those of a parent theme, you can easily see what you’ve adjusted and undo any unwanted changes.

You will need a basic understanding of CSS and HTML to make changes, and some PHP knowledge would also be helpful.

How do child themes work?

A WordPress child theme is stored in a directory which is separate from the parent theme. Each has its own style.css and functions.php file, and you can add other files as needed. You must have the two files above in your child theme for it to work right.

With the style.css and functions.php files, you can alter anything you need to, including:

  • styling
  • layout parameters
  • coding
  • scripts

You can adjust these items within your child theme even if they are not present in the parent theme.

When someone visits your site, WordPress first loads your child theme, then retrieves any missing styles and functions using parts of your parent. This means that you get the most out of your customized child theme design without taking anything away from the parent theme’s core functionality.

Create a child theme in WordPress

There are a few ways to create a child theme, including manually using an ftp client or file manager, using a WordPress plugin, or with the help of an online child theme generator.

For those of you who prefer video tutorials, here you go.

Manually via ftp or File Manager

1. In either your ftp client or File Manager within your hosting account cPanel, navigate to your themes folder under public_html > wp-content > themes.

2. Create a new folder within the theme directory. It is recommended that you name it the same as your parent theme, but with -child on the end (e.g. mytheme-child). Make sure you don’t have any spaces in the name, but use hyphens (-) instead.

PLEASE NOTE: In this example, we’re creating a style.css file based on the Twenty Twenty WordPress theme. Adjust your file as needed with the proper attributes.

3. Using a text editor, create a file called style.css, and populate it with the following code:

/* 
Theme Name: Twenty Twenty Child 
Theme URL: http://yourdomain.com
Description: Twenty Twenty Child 
Theme Author: Your Name
Author URL: http://yourdomain.com
Template: twentytwenty 
Version: 1.0.0 
Text Domain: twentytwenty-child 
*/

4. Adjust the fields as necessary, paying extra attention to the Template line. It lets WordPress know which parent theme your child theme is related to. Once finished changing the info, make sure to save your changes.

5. Create another file using your text editor and name it functions.php. Don’t copy the code from the parent theme file because you want it to be separate and customizable. Paste the following code in your child theme’s functions.php.

<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
   wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>

6. Log in to your WordPress dashboard and go to Appearance > Theme. Click the Activate button on the child theme you just created, and preview it on the front end.

Use a child theme plugin

Instead of creating your child theme manually, you can instead use a plugin. There are a few you can choose from, including the following:

  • Child Theme Configurator
  • Child Theme Generator
  • Child Theme Wizard

For the purposes of this tutorial, we will use the Child Theme Configurator plugin. Follow the steps below to create your child theme.

1. Log in to your WordPress dashboard and go to Plugins > Add New.

Add New Plugin in WordPress dashboard

2. Search for Child Theme Configurator and once you find it, click Install Now.

Child Theme Configurator plugin

3. Activate the plugin and navigate to Tools > Child Themes.

Tools > Child Themes in WordPress dashboard sidebar

4. Under select an action, choose CREATE a new Child Theme. Select your Parent Theme from the dropdown and click Analyze to check for stylesheet dependencies and other possible issues.

Create a new child theme
Analyze parent theme

5. Select a name for your child theme directory (this is not the name of your Child Theme, which you can customize later).

Set name for child theme directory

6. Pick where you want to save new styles. Generally, you’ll want to select Primary Stylesheet (style.css). This will save new custom styles directly in the Child Theme’s primary stylesheet, and will replace existing values.

Choose where to save styles

7. Specify how the Parent Theme stylesheet is handled. Typically, you’ll want to select Use theWordPress style queue and let the plugin determine the proper actions and dependencies. This will update the Child Theme functions.php file automatically.

8. Optionally, you can enter Child Theme Name, Description, Author, Version, etc.

Customize child theme attributes

9. Then, you choose whether you want to copy the Parent Theme menus, widgets and other customizer settings to your Child Theme (CAREFUL: this will overwrite any Child Theme options you’ve already set).

Copy menus, widgets and other customizer settings

10. Click the button to run the Configurator.

Create new child theme

IMPORTANT: Before you activate your child theme, check it with Live Preview.

Once you’ve previewed your child theme and ensured that it’s all right, you can go ahead and activate it.

Use an online child theme generator

In addition to the methods mentioned above, you can use a free online child theme generator. It’s easy and only takes a couple minutes.

1. First, head over to https://childtheme-generator.com/.

2. Click the button that says Create your child theme now.

Child theme attributes in the online child theme generator

3. On the next screen, fill out all details and click the Create your child theme now button at the bottom of the form.

Download your child theme from the online child theme generator

4. On the next page, click the Download your child theme now button.

Upload theme in WordPress dashboard

5. Now, log in to your WordPress dashboard and go to Appearance > Themes. Then, click the Add New button near the top. On the next screen, click the Upload Theme button.

6. Then, click the Choose File button, locate your downloaded child theme and click the Install Now button. Once it uploads the file, click the Activate link on the next page.

Conclusion

After reading this tutorial, you now realize how important it is to use a child theme on your WordPress website. It will make it easy for you to customize your site and not worry about losing your changes when the parent theme is updated. Another reason to use a child theme is that it lets you easily keep track of edits you’ve made, and undo any unwanted changes.

Do you have anything you care to add? We strive to make our WordPress tutorials as in-depth as possible, and always welcome additional information. Please feel free to leave a comment with your questions or comments below.


If you found this post helpful, please share it and spread the word!

Want more like this? Sign up for my newsletter to receive helpful WordPress Tutorials, Tips and Tricks.

8 thoughts on “Create a Child Theme for your WordPress Website: 3 Different Methods”

  1. Yes it did thanks! Now I just need to remember exactly where I made all those changes!!! UGH!

    Thank you sooo much for your help, it is greatly appreciated!

    Barbie

  2. I’ve followed your steps here using Child Theme Configurator plugin. My question is, will any links I have used on the Parent Theme for phone numbers, websites, and any others, work while I Preview the Child Theme? Currently they do not work on Live Preview. I could not find any mention of this within many articles I am reading. Just wondering if the links are not shown until the child theme gets activated. I have several sites that I have customized over the years and now want to make a child theme in order to update the original theme. Thank you.

    1. Hi Randy,

      It depends on what theme you’re using. What is the site URL so I can take a look? Are you referring to header and footer links. You should be able to update the parent theme and keep the links no problem. You can always give it a shot, but make sure to have a full site backup just in case.

      Using a child theme is recommended so that changes made within functions.php (and others) are kept when updating the parent theme.

      Hope that helps, but feel free to respond with your site URL and I’ll take a look.

      Best,
      Marshall

  3. Barbie Sablon

    Thank you for answering! The plugins I was referring to are the ones you suggested on your website (child theme plugins). Will they detect the changes?

    Thanks!
    Barbie

    1. Hi Barbie,

      Those plugins are specifically related to creating a child theme on your site, and have nothing to do with detecting any changes you made to the parent theme files. Hope that helps!

      Best,
      Marshall

  4. At the risk of sounding stupid…What happens if I have made MANY changes in the parent theme? As a newbie and non-developer, I did not log all of the changes that I made :o(
    If I use one of the plugins will it know what has been changed automatically? I have been afraid of updating the theme and now my Elementor will not work with it. Grrrrrrr!!! Please help?

    1. If you made any changes within any of the php files in the parent theme, those changes will not be saved when you update the theme. I am not sure which kind of plugins you’re referring to. As far as changes within Elementor, those should remain even when you update the parent theme. Take a backup before you update just in case. Hope that helps!

Leave a Comment

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

Scroll to Top