How to create a child theme in WordPress

Regardless of the theme you’ve chosen for your WordPress site, chances are you’re going to want to tweak and customize elements of it to suit your needs. You’re also going to want to ensure your theme is secure and up to date. However, if you hit the Update button after making adjustments directly to your theme, all your hard work could go right down the drain.

Creating a child theme will help you avoid this nightmare scenario. Essentially, a child theme is a ‘spinoff’ from its ‘parent’, from which you can then make modifications and changes, and carry out an update without losing them in the process.

In this article, we’ll delve deeper into what child theme are, what sites they are best suited for, as well as their advantages and disadvantages. Next, we’ll take you through how to create a child theme in WordPress. Let’s get cracking!

HOW CHILD THEMES WORK AND WHO THEY ARE MOST SUITED FOR

In a nutshell, a child theme inherits the functionality, design, and coding of its parent theme. While you can use it to experiment with different elements and features, it’s usually a permanent fixture of your site, and it becomes the de facto primary theme within your installation.

Overall, if you intend to modify the code under the hood of your WordPress site, you should use a child theme. This will preserve your changes, and give you flexibility if you wish to make tweaks to your design.

THE ADVANTAGES OF USING A CHILD THEME

Child themes present an awesome way to speed up site development. This is largely because they can be rapidly created – especially when using a ‘code-free solution’. Child themes can also help those looking to hone their theme development skills in a more secure environment, although it’s definitely a secondary benefit.

If you’re looking to create multiple websites with a similar look and feel, copying and pasting the files from a child theme you like could speed the process up.

We’ve already touched on how a child theme preserves changes when the parent theme is updated, and combined with the above, they’re a powerful feature of WordPress.

THE DISADVANTAGES OF USING A CHILD THEME

Of course, no solution is perfect, and in order to use your child theme effectively, you’ll need to thoroughly familiarize yourself with the various functions and hooks of the parent theme. Depending on how feature heavy the parent theme is, this could require a major investment of time. WordPress beginners, or those with light technical knowledge, may also find this process overwhelming.

Another potential disadvantage is that, if your parent theme is abandoned by developers, your child theme runs the risk of developing security loopholes.

WORDPRESS CHILD THEME TUTORIAL

There are two main methods for creating a child theme. Doing so manually will give you more control over the theme’s settings and attributes. However, using a plugin serves as a time-saving alternative. Let’s start with the manual method.

THE MANUAL METHOD

To carry out these steps, you’ll need to install a File Transfer Protocol (FTP) solution and bone up on your FTP skills if necessary. For this example, we’ll use FileZilla, as it is user-friendly, reliable, and well-documented.

STEP #1

Once you’ve opened up FileZilla, input your credentials into the Host, Username, Password, and Port fields. If you can’t find them in your hosting account’s back end, contact your provider’s support for assistance:

After you’ve done this, you should see the files your server contains in the upper right-hand quadrant, at which point you’ll want to move onto step two.

STEP #2

For this tutorial, Twenty Seventeen will be our parent theme. In the upper right-hand quadrant, navigate to wp-content > themes:

Next, we’ll look at creating the child theme itself.

STEP #3

FileZilla’s bottom right-hand quadrant contains your selected folder’s files. This is where we’ll create our child theme, so create a new directory and name it twentyseventeenchildtheme:

Once your directory is created, you’ll need to ‘link’ the parent and child theme.

STEP #4

Within the newly-created directory, create a new file and name it style.css. Next, open the file in your preferred text editor (TextEdit or Notepad will suffice at this stage), and paste in the following code (replacing the information pertaining to the Twenty Seventeen theme with that of your chosen parent theme):

/*
Theme Name: twentyseventeenchildtheme
Theme URI: https://wordpress.org/themes/twentyseventeen/
Description: Twenty Seventeen Child Theme
Author: John Doe
Template: twentyseventeen
Version: 1.0
*/

From here, simply save the file and you’re done! You’ll be able to access your child theme by navigating to Appearances > Themes in your dashboard and activating it.

Finally, your site’s design may not look anything like that of your parent theme, and this is normal. Check out the WordPress Codex page on child themes to find out how to ‘enqueue’ your parent theme’s style sheet.

THE PLUGIN METHOD

If you’d rather learn how to create a WordPress child theme without any coding, there are a number of excellent plugin solutions to choose from. Let’s take a look at some of them.

CHILD THEME CONFIGURATOR

This plugin makes it easy to rapidly generate a child theme, and customize it with options not provided by the default WordPress Customizer. It comes with an intuitive interface, letting you create and customize your child themes in seconds.

Child Theme Configurator also lets you identify and override the exact Cascading Style Sheet (CSS) attributes you want to customize. Although the basic plugin is free, a premium version is available for $19.95.

CHILD THEME CREATOR BY ORBISIUS

This extremely lightweight but versatile plugin lets you generate a child theme in just one click. It also includes a handy feature to let you edit two theme files simultaneously (which is useful if you are creating a series of sites with a similar look and feel). Also, the choice of two theme editor screens takes the hassle out of selecting and transferring code snippets between themes.

Child Theme Creator by Orbisius is well-documented and supported, and has a free version available. More feature-heavy premium version of the plugin starts at $4.99.

CHILD THEMIFY

Despite being among the more basic child theme plugins, Child Themify is practical, streamlined, and completely free.

It features a suite of drop-down menu options letting you set the parent theme, the child theme name, and any additional theme files you’d like to include. As with Child Theme Creator, you can generate your child theme with one click.

Advertisements

1 thought on “How to create a child theme in WordPress

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close