How to make a WordPress Child Theme
|

Create a WordPress Child Theme – Quick & Easy!

You don’t need to create a child theme in WordPress unless you plan to dig in and update the original theme’s files. This should only be done by a seasoned web developer who understands HTML and PHP coding.

But if you do, and want to change either the functionality or design of the original theme, then it’s best to create a child theme. Why? Because theme developers often update their files (and should) regularly to add features, templates, and patch any security holes. If you update a WordPress theme’s original files, they will be overwritten when it’s updated. Then you’ve lost all your work.

But when you create a child theme, you can copy the files you want to modify and store them in the child directory, which does NOT get updated with the parent theme.

A child theme depends completely on its parent in order to work. So make sure you keep the parent theme in the /wp-content/themes directory.

To create a WordPress You will need access to the file system. Either through File Manager or FTP.

Navigate to /wp-content/themes

Notice the name of your parent (original) theme. For this example, I’m using an original theme called “wave

1. Create a folder with that same name with -child after it. So my directory will be wave-child

Create a new file called style.css and put this code in it. Replace wave with your original theme name. See notes below the code.

/*
Theme Name: Wave Child
Description: Wave Child Theme
Template: wave
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wave-child
*/

IMPORTANT – THIS MUST BE CORRECT in order for this to work:
Template: The FOLDER name of the parent theme. THIS IS CASE-SENSITIVE.

2. Create a new file called functions.php and put this text in it. As-is, no changes:

<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );

function enqueue_parent_styles() {
   wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>

You now have a child theme.

OPTIONAL:
It’s really helpful to also upload a custom thumbnail for this theme. Name it screenshot.png and it will appear in the WordPress Admin Themes panel. I usually just copy the original screenshot.png file and put the word “CHILD” on it, big and bold like this:

 

CUSTOMIZING A THEME FILE OR TEMPLATE
Now if you want to modify any of the original theme’s templates, copy the file from the original theme’s directory to your new child theme’s directory.

MAKE SURE they have the same path and file name! So if the original template is /wp-content/themes/originaltheme/templates/page.php then copy the file to /wp-content/themes/originaltheme-child/templates/page.php.

_____________

Are you a WordPress developer that needs a little help? Contact me – I love troubleshooting.

Similar Posts