How to Create a Child Theme in WordPress

WordPress

If you are someone that likes to make various tweaks and modifications to an existing WordPress theme, it can be beneficial to create a child theme so that you can carry out any changes in a standalone directory without the worry of work being affected or overwritten by any updates.

Child themes are popular with developers and are now offered by providers of frameworks. They are also easy to create, requiring just one folder and one file. This guide will show you how to set up a child theme in minutes.

Creating a Child Theme Folder

To get started you will first need to access the directory of your website. You can do this via an FTP client or the file manager application of your hosting provider; however, the former is the recommended option as adding and editing files is much easier. If you do not currently have an FTP client, I recommend FileZilla as it’s free and simple to use.

Login to your website via FTP and locate the folder /wp-content/themes/. This folder contains all of the themes installed on your website. In themes, you will need to create a new folder for your child theme. It’s entirely up to you what you call this folder, but to keep things simple you should keep the name the same as the parent theme with the addition of “–child”. For example: “twentytwelve-child”.

Creating a Child Theme style.css File

Only one file is needed to create a child theme and it is merely an extension of the parent theme style.css. With the child theme folder in place, you can begin creating this file. Open your text editor and copy and paste the following code:


/*

Theme Name:     Your Child Theme's Name

Description:    Your theme's description.

Author:         Your Name Here

Template:       twentytwelve

(optional values you can add: Theme URI, Author URI, Version)

*/

@import url("../twentytwelve/style.css");

The twentytwelve theme has been used as an example and will need to be replaced with the name of your own theme, as will the generic information regarding name and description. The “Template” field and “@import url” must be changed to identify the themes parent.

This information will act as an addendum to the parent theme and should be placed at the top of the file, before saving the new style.css file to the child theme folder that we created earlier.

Activating the Child Theme

To activate the child theme you will need to login to your WordPress dashboard (www.yourwebsite.com/wp-admin) and go to Appearances > Themes. Your parent theme will be displayed as active and your child theme will be shown as an available theme below with the name and author details displayed. Click on the blue “Activate” link and you are ready to tweak away.

If you make any changes to the PHP files of your parent theme in the future, simply copy and paste them into your child theme directory to activate them in your child theme.

Share it!Share on FacebookTweet about this on TwitterShare on Google+Email this to someone

Our Recommended Wordpress Web Hosting Provider

WordPress

WHC.CA
Get a 50% Discount by using our link.

WHC.ca

Reliable host, with excellent customer service and an easy one-click Wordpress installation. Our recommendation to host a Wordpress blog.

Leave a Reply

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