Hosting Tutorial & Guide

How to Create a Child Theme in WordPress with the Least Effort

updated on May 11, 2016
How to Create a Child Theme in WordPress with the Least Effort If you have ever had the need to modify a theme on your WordPress site, then you must know something about child theme. Technically speaking, a child theme is the theme that comes with all the styling and functionality of another theme (the parent theme), but it cannot work alone without the parent theme existing on the same site.

Everyone who adds custom styles to existing themes should use a child theme because such a theme helps eliminate all the headaches in the future theme update. Certainly, if you have acquired some skills, you can manually update a customized WordPress theme without losing the customizations, but with a child theme, you can simply update the parent theme with one click while keeping all custom codes unaffected.

However, due to the lack of understanding about child themes or the difficulty of creating a child theme, only a small portion of WordPress users are using a child theme for customizations.

Creating a child theme manually is not too hard, but the requirement for dealing with files and codes still stops many WordPress users from having a try. Therefore, in this tutorial, we will introduce two of the easier solutions than the manual method: automating the child theme creation with Use Child Theme, and simplifying the creation with a plugin.

In case you may still want to try creating a child theme manually, this handy tutorial is available to guide you through.

Automate the Creation of Child Themes with Use Child Theme

Developed by FacetWP, Use Child Theme is a free project that provides so far the easiest way for both theme developers and normal WordPress users to create child themes.

With the use of this project, your users with the capability to edit themes are always prompted a child theme activation link when they try to edit a theme with no child theme currently enabled. And once they click on the activation link, a child theme is created and enabled automatically.

Use Child Theme minimizes the difficulty of creating child themes. Besides, a child theme generated by this project is fully functional, coming with the necessary files including functions.php and styles.css.

Now follow the tutorial below to know more about the project and make full use of it.

Step 1: Add Use Child Theme to your theme directory

Implementing Use Child Theme to your themes is super easy, and the first thing is to add the needed file to a theme directory.

To get this file, you have to visit this project page hosted at GitHub and locate the file named "use-child-theme.php". Note that you don't need to download the zip file of the entire project.

Locate the PHP File

Open the PHP file to view the codes. Then, create a new text file on your local computer with a text editor, and copy ALL the codes to this file. Make sure you are not missing a single line. At last, save the file in plain text. You can name it as anything that is easy to identify.

Copy Codes

Next, access the directory of the theme that you want to create a child theme for by using FTP or a file manager. The location should be "/wp-content/themes/yourtheme". Upload the text file you created before to the directory and rename it as "use-child-theme.php". This is the exact file name that you must use, or the project won't work.

Upload File to Theme Directory

Step 2: Modify the functions.php file

After the file is placed properly in a theme directory, you now need to find the functions.php file of this theme in the same directory, open it, and add the line of code highlighted below in it. The code could be located at any place that is not commented out. For future reference, you are also suggested to add a comment to explain the code.

Edit functions.php File

The steps above work for one theme at a time, so in the case you want to use the project for multiple themes on your WordPress site, you have to add the Use Child Theme file to each of the theme directories and edit the functions.php of each theme.

Enjoy the automation

If the theme that you have modified is already active and it does not come with a child theme, you can now see the magic. When you access the Appearance > Editor in WordPress dashboard trying to make modifications, you will see a notification that reminds you to activate a child theme before modifying the stylesheet.

Activate Child Theme

Clicking on the "Activate now" link, the Use Child Theme project will create a child theme and get it activated automatically. Since these tasks are handled behind the screen, you only need to wait a few seconds until the success message appears saying "All done!". There is nothing to do by yourself.

Important note: The Editor screen is refreshed automatically after the child theme is activated. However, if you are careful, you should have found that the refreshed screen is still loaded with the parent theme instead of the child theme. So, before editing the stylesheet, make sure to refresh the page again to load the child theme.

Refresh to Load Child Theme

Create a Child Theme by Using Child Theme Configurator

If you want to create child themes without dealing with the theme files, then you can try the Child Theme Configurator plugin which not only enables easy creation of child themes but also helps you take full control of them directly in the WordPress dashboard.

To use the plugin, you first have to install it, of course. For any confusion about this process, read our WordPress plugin installation guide.

After activating Child Theme Configurator, go to Tools > Child Themes to start creating your child theme. When you use the plugin for the first time, you are presented with a "Parent/Child" tab which displays the steps you need to complete.

The step 1 is to select an action. As the plugin is feature rich, it allows you to create new child themes as well as to configure existing child themes. But for our task, we selected the first option to create a child theme.

Create a Child Theme

The step 2 is to select the parent theme for which you would create the child theme. Simply make a choice in the dropdown. Then, take the step 3 and click on the "Analyze" button to let the plugin determine the stylesheet dependencies.

Analyze Parent Theme

If there is nothing wrong with the parent theme you choose, then you will be presented with six more steps. You should deal with them one by one to make sure you don't miss any necessary step.

In step 4, enter a custom name for the new child theme directory which will be created by the plugin. The only requirement is still to make it easy to identify. And for step 5 and step 6, you can leave the default options untouched because they work fine in most situations.

Configure Child Theme

Step 7 includes a form which allows you to customize the child theme. You can use your own child theme name, website, author name and author website, and add custom theme description and theme tags.

Customize Child Theme

If you want to copy the menus and widgets from the parent theme to the child theme, you can tick the checkbox in step 8. After making this decision, click on "Create New Child Theme" to let the configurator handle the rest works.

Run Configurator

Waiting for about two seconds, you will get a success message. In this message, there is a link for previewing the child theme. To prevent unexpected problems (for example, the child theme is not created properly), you have to follow the link to have a live preview before activating the child theme.

Preview Child Theme

If there is no problem with the new child theme, you can activate it in Appearance > Themes in the same way you do with any WordPress theme.

Activate Child Theme

With the use of Child Theme Configurator, you don't need to touch any theme file during the entire creation process, which makes it super easy to create a child theme.

In fact, the plugin also comes with a number of useful CSS editors which enable you to search styles, add additional properties, store multiple property values, use web fonts, etc. You can certainly get the power you want by exploring more.