How To Create WordPress Child Theme

It is pretty simple to create a WordPress child theme. Here is how you do it:

I will use wordpress default theme `twentynineteen` as example
1.  Create a new folder in the `wp-content/themes` directory, and named it with the parent theme name plus `-child` at the end of the name. So, if the parent theme’s name is `twentynineteen`, the child theme folder name will be `twentynineteen-child`

2. Inside the child theme folder, create `style.css` and `functions.php` files.

3.  In `style.css`, and add following script at the head of the file:

Theme Name: Twenty Nineteen Child
Theme URI:
Author: the WordPress team
Author URI:
Requires at least: 4.9.6
Requires PHP: 5.2.4
Version: 1.5
Text Domain: twentynineteen
Template: twentynineteen

There are few part that essential in this file.

    • Theme Name : name that will show up for your theme in the WordPress back end.You can name it with anything you like, but conventionally just append Child to the parent theme’s name.
    • Template : Most crucial part. This is the name of the parent theme folder’s name. It is case-sensitive, and if you don’t put in the right information, you will receive an error message. Please double check.

4.  In `functions.php`, add following script:

add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
   wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );

5.  This step is optional, you can create an image with the name `screenshot.png` (means it is png format) into the folder. This image show up for your theme in the WordPress back end. You can also copy from the parent theme.

And this. You are good to go.

If you did not see your child theme appeared in the admin backend theme page. Scroll down the page you will see the error messages in the Broken Theme section, for eg:

And you can fix your problem accordingly.

Leave A Comment