Creating WordPress Child Themes

March 12, 2014SupportLeave a reply

What is a child theme?

Simply put, a child theme is one that inherits the functionality of its parent theme. It allows you to make modifications to the theme of your choice without directly altering theme files – this is the safest and fastest way of getting your theme to look just the way you want it to, especially if you are a beginning WordPress user. A child theme also prevents your code changes from being lost each time the parent theme receives an update.

How do I create a child theme?

Creating a child theme may sound daunting, but it actually only takes a few simple steps:

  1. Create a folder in the ./wp-content/themes folder for your child theme – make sure the folder name does not contain any spaces.
  2. In this new folder, create a style.css file containing the following text:
  3. /*
     Theme Name:     Twenty Thirteen Child
     Theme URI:
     Description:    Twenty Thirteen Child Theme
     Author:         John Doe
     Author URI:
     Template:       twentythirteen
     Version:        1.0.0
    @import url("../twentythirteen/style.css");
    /* =Theme customisation starts here
    -------------------------------------------------------------- */

    Only the Theme Name and Template lines are required. The others will provide further information for WordPress, but they are not compulsory. For Template, you’ll need to specify the name of the directory in which the parent theme is located – in this case, it’s twentythirteen.

    A child theme takes on the default characteristics of its parent theme, so you’ll need to define the URL of the parent’s style.css from which to import them, as shown in the example above:

    @import url("../twentythirteen/style.css");
  4. Activate your new child theme in Activate > Themes. Any style customisations you wish to make go below the specified line:
    /* =Theme customisation starts here
    -------------------------------------------------------------- */

Further customisation

Although style.css is the only file essential to creating a child theme, you can further customize the theme by overriding the following template files:

  1. index.php
  2. header.php
  3. footer.php
  4. page.php
  5. single.php
  6. archive.php
  7. etc …

Essentially, all page template files may be overridden.

The exception to this rule is functions.php – here, the child theme’s functions.php is loaded right before, and in addition to, its parent theme’s. This means that even if the parent theme is updated, your code changes will remain intact. There is no need to copy the full content of the parent theme’s functions.php into the child theme.

About author:

Dawn is the Community Manager of PandaThemes.

Leave a Reply

Sorry, you can not to browse this website.

Because you are using an outdated version of MS Internet Explorer. For a better experience using websites, please upgrade to a modern web browser.

Mozilla Firefox Microsoft Internet Explorer Apple Safari Google Chrome