How To Create a WordPress Child Theme

Share

WordPress Child Theme

A child theme is a theme that inherits the functionality and styling of another theme, called the parent theme. Child themes are the recommended way of modifying any existing theme that you use on your WordPress site.

A child theme consists of at least one directory (the child theme directory) and two files (style.css and functions.php).

WordPress Child Theme

Creating a Child Theme

Creating a child theme is a tedious job and requires some basic knowledge of editing html, php, and css. Since the majority of WordPress users will not want to do that. Here  we will adopt more simpler way, that is by using a plugin.

Child Themify: Child themify is very simple and easy to use plugin to Create child themes from any non-child theme at the click of a button.

This plugin is multisite compatible; if used on a multisite network, controls for creating child themes will be in the network admin instead of the regular site admin.

Once you install and activate the plugin, go to Apperance >> Themes. Click on any theme and then click on “Create a Child Theme.

WordPress Child Theme

How Child Theme Works

When you activate the child theme, the WordPress will look for the template files in the child theme folder first.

If the file doesn’t exist in the child theme, it will fallback to the parent theme folder. In other words, if there is a “index.php” in the child theme, WordPress will use that “index.php”, else it will use the “index.php” file located in the parent theme. This is actually great because it allows you to modify only what you need.

Child themes should always be used if you plan on modifying even a single character in your theme.

Why Use a Child Theme?

There are a few reasons why you would want to use a child theme:

  • If you modify a theme directly, and it is updated, then your modifications may be lost. By using a child theme you will ensure that your modifications are preserved.
  • Using a child theme can speed up development time.
  • Using a child theme is a great way to learn about WordPress theme development.

WordPress child theme allows you to change the functionality of the theme without having to edit the original/parent theme template files.

If you need to modify any template file, you need to create a child theme instead of editing the theme template files. Since the child theme is stored separately, you don’t need to make the changes again when you upgrade the theme.

Child themes was introduced in WordPress 3.0 and later. It was introduced so that you can modify or change (override, actually) all aspects of a Parent theme.

In other words, you now are able to change the settings in the stylesheet, page templates, and functions of the Parent without having to worry about losing all of your modifications when upgrading the Parent WordPress Theme.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *