Create a Child Theme

What is a Child Theme and Why Should I Use One?

When I first started developing WordPress websites, I didn’t use child themes and like most things that I do I learned the hard way why I should use them.

First of all, a child theme is a way to use the theme that you like and customize it without losing your changes when the theme developer upgrades the theme. If you have a decent theme, it will get upgraded.

When I first learned about child themes I was concerned that I could not do it, after all I wasn’t a theme developer I just knew how to customize themes for my clients.

A correctly set up child theme is super simple. You need to create two files and save them to a folder on your computer.

Open your text editor. (I use Komodo Edit. It’s free and easy to use. )

Create a new file. Add the following code.

/*
Theme Name: Twenty Fifteen Child (Replace this with the name of your parent theme. In this case I am creating a child theme for the Twenty Fifteen theme.)
Description: Twenty Fifteen Child Theme
Template: twentyfifteen (This is the name of the parent theme)
*/

Make sure you change the Theme Name to your child theme name. I have a theme called Spa so I would change the code to:

Theme Name:  Spa Child
Description:  Child theme for the Spa theme
Template:  spa

Save and name the file style.css into a folder that is labeled with your theme name. I would name this folder Spa Child in this case.

Next, create another file in your text editor (Komodo Edit) and copy and paste the following code.

<!--?php function theme_enqueue_styles() { $parent_style = 'parent-style'; wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ) ); } add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); ?-->

Save and name this file functions.php into the same folder as style.css.

If you are on a Mac click on the folder that you saved these files in and compress it into a zip file. (Right click and choose compress).

Upload this zipped file like you would a normal theme. Make sure you have your parent theme installed first.

Once you upload it, activate the child theme and it should look just like your parent theme.