How to Create a Child Theme in WordPress

A child theme is a theme that inherits the functionality and styling of another theme. Child themes are the recommended method of modifying and extending an existing theme.

Using a Child Theme has several advantages including being:

  • Safer: You won’t lose all your modifications if the parent theme is updated.
  • Faster: It can speed up your development time.
  • Easier: Parent Theme functions can often be easily overridden or extended.

Building a Child Theme

A simple Child Theme which consists of the Child Theme directory, and two files (style.css and functions.php). You can addition files to extend and override the parent but the directory, stylesheet and functions file are the base requirements for a Child Theme.

Child Theme Folder

Create your Child Theme directory in wp-content/themes/.

Child Theme Stylesheet

  1. Create your Child Theme’s stylesheet style.css in the root of your Child Theme’s directory.
  2. Add the WordPress theme declaration to the top of your Child Theme’s style.css e.g.
    /*
    Theme Name: My Child Theme
    Theme URI: http://example.com/my-child-theme
    Description: Description of your child theme
    Author: WiseInternet
    Author URI: http://example.com
    Template: parent-theme-folder-name
    Version: 1.0
    */

    Template corresponds to the directory name of the Parent Theme your Child Theme will inherit from e.g. If you were using “Twenty Sixteen” as the Parent Theme the Template would be twentysixteen.

Child Theme Functions File

  1. Create your Child Theme’s function file functions.php in the root of your Child Theme’s directory.
  2. Your Child Theme’s functions.php should include:
    <?php
    function mytheme_scripts_styles() {
    // Enqueue the parent theme style sheet
    wp_enqueue_style( 'parent-style', trailingslashit( get_template_directory_uri() ) . 'style.css' );

    // Ensure the default WordPress stylesheet is enqueued after the parent style sheet
    wp_enqueue_style( 'style', get_stylesheet_uri(), array( 'parent-style' ) );
    }
    add_action( 'wp_enqueue_scripts', 'mytheme_scripts_styles' );

Activate the Child Theme

  1. Login to your WordPress Dashboard.
  2. Navigate to Appearance > Themes and a Activate your Child Theme.
Scroll to Top