Creating and Using Child Theme in WordPress

# What is Child Theme

According to wordpress.org, “a child theme is a theme that inherits the functionality and styling of the parent theme”. Just like parent classes are inherited by child classes to use the properties of parents, child themes does the same. Child themes are the recommended way of modifying an existing theme.

# Why to Use Child Themes

As mentioned child themes are always handy when it comes to customization of any existing themes. Below are some of the points to clarify its importance and why to use it.

Secured Future: Creating a child theme when performing adjustments to a theme’s code can save a lot of future headache overall.
Parent updates: Child themes allow to make changes without affecting the original theme’s code, which makes it easy to update the parent theme without erasing the changes made.
Easy customization: By creating a child theme, a separate set of files are created that can be used to customize the theme without affecting the original theme at all.
Risk free: Not only does this make updating easier, it also makes sure that the original theme is never ruined as all the modifications are done on the child theme and original files are never actually modified.
Options: One can always turn off the child theme and fall back on the original.

# A Survey

According to a recent WordPress Themes Survey, 85% of our customers customize their themes, and only 35% use a child theme when doing so. This may be due to a lack of understanding as to what a child theme is, or due to the perceived difficulty of creating one.

# How to create a Child Theme

The process of creating a child theme is explained below.

Example
Here, a child theme for a theme called Business(say) is created.
First, a new folder for the child theme is created. Naming it something like /business-child/ is conventional. Within that new theme folder, a file called style.css (as on parent) is created and is filled with the information as below.

/*
Theme Name: Business Child Theme
Theme URI: http://www.businessthemes.com
Description: Business Child Theme
Author:
Author URI:
Template: Business
Version: 1.0.0
*/

Second, a file called ‘functions.php’ is created in the child theme as on the parent theme with the below codes:
add_action( 'wp_enqueue_scripts', 'business_theme_enqueue_styles' );
function business_theme_enqueue_styles() {
wp_enqueue_style( 'business-parent-style', get_template_directory_uri() . '/style.css' );
}

This function will enqueue the parent styles and render it on the child theme.

Alternately, for those who are not familiar with codes, child theme can be created by the help of plugin such as:

These plugins create child themes quickly and easily from any theme that are installed on any site/blog.

Thats all, creating child theme is just a two step process if coding approach is followed. Or, plugin can be used as well. So in a nut shell, child theme is always considered best when it comes to customization.

Leave comment

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