How to Create a WordPress Child Theme | Step by Step
By Categories: Web Development, Wordpress1.5 min read

Follow the following steps to create a WordPress child theme.

Step 1: Go to your themes folder

Step 2: Choose a theme you want to have a child theme

Watch the following video that covers the whole process of creating a child theme. Either way, continue on the rest of the steps:

Step 3: Create a new folder for the child theme.

Any name will do. The folder should be the same folder as your parent theme (not inside).

Step 4: Create two files inside the child theme folder.

Create a functions.php and style.css files inside the folder.

Step 5: Refer to the WordPress Theme Handbook.

Copy and paste the example theme basic info into your style.css file.

[css]

/*
Theme Name: Twenty Fifteen Child
Theme URI: http://example.com/twenty-fifteen-child/
Description: Twenty Fifteen Child Theme
Author: John Doe
Author URI: http://example.com
Template: twentyfifteen
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twentyfifteenchild
*/

[/css]

Copy and paste the enqueue function into your functions.php file.

[php]

add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
function my_theme_enqueue_styles() {

$parent_style = ‘parent-style’; // This is ‘twentyfifteen-style’ for the Twenty Fifteen theme.

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 ),
wp_get_theme()->get(‘Version’)
);
}

[/php]

Step 6: Go to the wordpress admin dashboard and activate your child theme.

When you visit the website, it should the same as when the parent theme was activated. You’re done!

Done!

Now you can create modifications/changes in your child theme without affecting the parent theme’s core files.