How to Create A Child Theme in WordPress

One of the many reasons why I recommend WordPress is that there are lots of themes available online. WordPress themes are incredible, they can help you save a lot of time and effort as far as designing is concern. And I must admit most of the time you don’t need to edit them for they all look good and are SEO friendly as well. However, there are times that you have to go to the back-end of your WordPress theme and do some editing on its functions and appearance to fit your needs. And when you need to do that you would want to create a Child Theme first before dissecting your WordPress theme.

What is a Child theme anyway. Well I cannot explain it better than how the WordPress Developers explain it.

“A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to modify, or add to, the functionality of that parent theme.”

Aight let’s roll our sleeves here and start creating a Child theme, believe me when I say that it is easier than how it sounds.

1. Login to your cPanel

Login to your hosting account and look for the File Manager folder and locate the domain that you want to work on.

2. Create a Folder

In your File Manager go to wp-content folder and then to the themes folder - in your themes folder you will find all the themes that are uploaded in your WordPress website. Click on the New Folder and a small window will appear, you can name it yourtheme-Child or whatever works best for you.

3. Create a style.css file

You need to add a style.css file to make your child theme valid. This file will kind of work as an accompaniment to your parent theme’s style.css file. Do this by clicking on New File and name it style.css. Edit the file and put the following code. and hit “save”.

/*
Theme Name: My Child Theme
Theme URI: http: //mysite.com/
Description: This is a custom child theme I have created.
Author: My Name
Author URI: http: //mysite.com/
Template: parenttheme
Version: 0.1
*/
@import url(“../parenttheme/style.css”);

4. Activate your Child theme

Congratulation you now have a child theme! Simply go to the dashboard > appearance > themes of your WordPress website and you will find your Child theme. Just hit “Activate”

 

5. Making Further Changes and Additions

Now that you already have your Child theme, you maybe wondering what if you would want to make changes to your parent theme’s PHP files. It’s quite simple, do the following and whatever changes you make will go live to your website. The same process applies to all available PHP files.

  1. Make a copy of the specific PHP file and
  2. paste that copy into your child theme’s directory.

A very important thing to keep in mind is that the directory path in your child theme MUST match that of the parent theme’s. So if you decide to edit a PHP file in “/parenttheme/includes/external/php/example.php”, you should place it in “/childtheme/includes/external/php/example.php”.

That’s all there is in creating a child theme for your WordPress website. You are now ready to tweak your favorite WordPress theme without overwritng the Original/Parent theme’s functionality and design.