How (And Why) to Create a WordPress Child Theme in the Next 5 Minutes

A WordPress child theme is simply a copy of a theme you have installed on your site.

And this copy allows you to make changes to the code of your theme, without affecting the original theme. The biggest benefit of this is that when the original theme is updated (and good themes are updated quite regularly), you don’t lose all your code changes, but still get all the benefits of the upgrade, since the theme upgrade gets passed down from parent theme to child theme, without overwriting the code changes you’ve made.

So the idea and implementation of child themes is actually very straightforward.  The problem is, the concept, and how to get it up and running on your site isn’t always clearly explained.  So this tutorial is an attempt to put that right!

But first of all – it’s worth noting that if you never actually make changes to the code of your theme (or don’t plan to make changes), then you don’t necessarily need to worry about child themes at all. If all changes you make to a theme are made directly through the theme’s control panel, rather than by tweaking the code, feel free to skip over this article entirely!  But…

Since there’s always a chance, even a slim chance, that you’re going to tweak some of the code of your theme in future, using a child theme is in fact recommended for pretty much every WordPress site.

And one last quick note before we dive into this – not all themes support the ability to create child themes.  All good themes should, and you can double check this by simply creating a child theme through the process below, and making sure everything (in the theme preview screen) looks and acts as it should, before you make it live on your site.

Okay, let’s get started…

You Decide: By Plugin, or by Hand?

If you want the quickest and easiest way to create a child theme, then there’s plugins that do just that. They hide most of the technical mumbo-jumbo from you, so if you’re not particularly technical, or just want to do this the easiest way, a plugin’s the way to go.

However, doing this process by hand does teach you more about working with WordPress, and as you develop these skills it helps you to manage your site more effectively. Plus, even by hand, this process can quite literally be done in five minutes.

But let’s start by creating your child theme using a plugin…

Creating a Child Theme Using: Child Theme Configurator

By searching the WordPress plugin directory for “child themes”, you’ll see plenty of options to help you with this process.  However, in this tutorial I’m going to talk through one plugin in particular that works well for easily creating a child theme.

So, without further ado, introducing the Child Theme Configurator:

Install and activate the plugin, and then you’ll need to go to the Tools menu and choose Child Themes:

So next, select the parent theme that you’re creating the child theme from:

Then choose Create New Child Theme and give your child theme a folder name in your WordPress installation.  This is often just the parent theme folder name with -child added:

 

Next, in Stylesheet Handling the default option of Enqueue parent stylesheet generally works absolutely fine:

Next you can choose an option to copy across menus, widgets and other customizer options from the parent theme:

If you find copying across the menus and widgets in this way causes issues with the child theme (I’ve noticed it does on occasion), then you may just want to recreate those in the child theme by hand.  And if you have any issues at all while setting up the child theme, you can just delete it of course and go through the process again with slightly different options.

But actually, it’s worth noting that when you’ve just installed a brand new (parent) theme and have decided that’s the one you really want to build your site around, it’s worth creating a child theme of it immediately before you really do any customizations at all. That way, all the work you’re doing right from the start is in the child theme, which gives you maximum flexibility when building up your site, while still allowing you to benefit from theme updates.

So leaving the remaining plugin options as the default settings should be fine, and then click on the Generate/Rebuild Child Theme Files button to create the child theme:

And that’s it!

You can then go to your themes screen and you’ll find the child theme has appeared. And then to check how it looks and to see if it’s all working as it should, just click on the Live Preview button:

And when you’re ready for your site to go live with the child theme, just click on Activate.

Or, Creating a Child Theme by Hand…

As mentioned, the benefit of creating a child theme by hand is it may give you more control, but in particular it helps you understand how the process works better, which allows you to run and manage your site better.

And even if you do choose to use plugins as a short cut, also knowing how the process works by hand allows you to double check that the plugin has worked correctly. Because I’ve noticed that some child theme plugins create quite a few unnecessary extra files that can make your installation of WordPress quite messy.

Okay, so this process assumes you’re comfortable working with files and folders on your server (either through FTP software, or using your host’s control panel), and that you know how to create and edit text files.

Now, I’m going through this demonstration using FileZilla as the FTP software.  For text editing you could just use Notepad, or something more powerful like Notepad++.

So first of all, navigate to your themes folder on your server.  In your WordPress installation folder, this will be in the wp-content folder and then in the themes folder:

Next, create a new folder on your server in that folder.  You can do this by right-clicking (on a PC):

And then create an appropriately named folder for your child theme.  This is often the name of the parent theme with -child added (just like we did when using the plugin):

Then you want to create an empty text file on your computer and name is style.css.

Next, open the empty file in a text editor and past in the following text:

/*
Theme Name: Name of Child Theme Goes Here
Theme URI: http://www.YourWebsite.com
Description: A description of child theme goes here
Author: Your Name
Author URI: http://www.YourWebsite.com
Template: twentyfifteen
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: enter some relevant tags if you like
Text Domain: twenty-fifteen-child
*/

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

You can replace most of the sample text on each line (the text after the colon), and it doesn’t make a huge amount of difference what you enter there as you’re likely to be the only one viewing it.

The line that you need to pay particular attention to is the Template: line. This should be the exact folder name of the parent theme in the themes folder.  For example, if you were creating a child theme of the Twenty Fifteen theme, the value you would enter there would be: twentyfifteen

And for Text Domain, this is the name of the folder created for the internationalization of the theme. So any folder roughly suitable to the child theme name is absolutely fine.

You also need to pay close attention to the @import line.  There you change parenttheme to the correct folder name for your parent theme.

So for Twenty Fifteen it would be:

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

So the entire style.css file could now look something like:

/*
Theme Name: Twenty Fifteen Child
Theme URI: http://www.AWebsiteAddress.com
Description: Child of Twenty Fifteen Theme
Author: John Smith
Author URI: http://www.AWebsiteAddress.com
Template: twentyfifteen
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: 2015,responsive
Text Domain: twenty-fifteen-child
*/

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

And then upload your updated style.css file into your child theme folder, and that should be it:

Then all that’s left to do is preview the theme to double check it all looks and works okay, and then activate it.

Okay, it’s worth noting that this approach to creating a child theme by hand isn’t considered best practice. What is considered best practice is to enqueue the parent theme stylesheet by creating a functions.php file in the child theme folder.  However, this can start to complicate the process considerably so we’re going to leave it out of this particular tutorial.  That said, a good plugin (like the one above) should use the best practice approach, therefore solving this problem for you!

And so, if you are interested in delving into this ‘more correct’ approach further, create a child theme using the plugin, and then view the files and code they create.  That will then give you a good idea of what’s correct, although will require some understanding of PHP.

So that’s a couple of ways you can quite literally create a child theme in five minutes.  The plugin approach is easier, but the ‘by hand’ approach does get you more involved with the process, which helps you to develop your WordPress knowledge, and can help you to have more control over the process, and over managing your site in general.