Summer Sale Alert! Save 20% on WP Theme Bundle: 240+ WP Themes & 5 Plugins. Use Code "SIZZLE20"
Summer Splash Sale: Dive into 25% Off On All Our Premium WordPress Themes! Use Coupon Code "SPLASH25" at Checkout.

What Are WP Child Theme And How To Create Them?

Whenever there is a question of adding functionality to your existing theme while creating your site, you always go for the desired plugin, right? But what if you are not getting the relevant plugin and are not ready to change the theme either as you are happy with it, then what do you do? The answer to this question is customizing your theme and the best way to do it is to use WP Child Theme. But what are they?

WordPress Child Themes

WP Child Theme

A WP Child Theme is not at all a standalone theme. It is evolved or derived from an existing parent theme and hence the name “Child”. You install this theme alongside the parent theme. However, a child theme gives you a chance to make the changes safely in your parent theme without editing the codes or stuff in the parent theme itself.

What a child theme does is it pulls most of or all of its design settings from the parent theme. However, when you try to make changes in the child theme, those changes will override the settings in the parent theme.

What Are The Benefits Of WP Child Theme?

Now you might have a question why you cannot make the changes directly to the parent theme? The biggest reason that making changes in the parent theme is not recommended is due to the theme updates.

In order to keep your WP site secure and function properly, you need to apply the updates as soon as they are released by the developer, and these updates include the theme updates as well.

If you try and customize your site directly by making changes in your theme itself, this means that you will overwrite all your changes each time you update your theme.

This implies that you either:

  • Update a theme and lose all your work. But this does not sound good, does it?
  • just don’t update the theme so that there is no danger of losing all your work. But this isn’t good from the point of view of your website’s security and proper functioning.

When you use a WordPress Child Theme, you will be able to make the desired changes in the child theme and this also allows you to update the parent theme without affecting or losing your existing work.

Not just this, a child theme is a great and convenient way of making customizations. This is because the child theme sorts and segregates all the changes at a single spot which makes it easy to keep a track of all the changes and edits you have made and twerk them further as and when needed.

Another benefit is that this makes it easy for you to go reverse. By this I mean, if you want to discontinue using the edits, you can go to the parent theme and you can disable the child theme.

There are a few WordPress themes available in the market that by default, use this parent and child theme approach to have control over the design.

WP Child Themes: When You Should Use And When You Shouldn’t

Generally, using a child theme is considered a good practice when you are looking to customize the WP theme you are using. But there are some exceptions as there might some other better options in such cases than using a child theme.

If you need to make a few minor CSS modifications, using a child theme for doing just a few tweaks is not a great idea. Instead of this, you can add the custom CSS by making use of the built-in additional CSS feature in the WP customizer. Or, you can also make use of the plugins that are available for free.

For making those changes that require you to be theme independent, then using a child theme will not be a good option. Consider an example: if you are registering a custom post type, you most probably don’t want to make use of the functions.php file of your child theme. Instead of this, you should add the code outside your theme entirely by making use of a relevant plugin.

Other than the exceptions listed above, you can always make use of WP Child Theme to make your own edits to an existing WP theme.

Creating WP Child Theme

Now that you have got an idea about child themes and their importance, let us now focus on knowing about the ways using which you can create a child theme for your WP site. If you are using a WordPress theme that comes along with the premade child theme, you can simply use it. But if your theme does not have a child theme, there are two ways that will help you create a child theme.

1. By using a Free WP child theme generator plugin

2. By manually creating a child theme.

How To Create WP Child Theme Using Plugin

By making use of a child theme generator plugin, you will be able to create a child theme for your WordPress site without even leaving your WP dashboard. Apart from helping you in creating the basic child theme files, The free Child Theme Configurator Plugin also scans the theme you are using and enqueues the theme as well as font style sheets as needed.

However, before using the plugins, make sure that you take a complete backup of your site. Ideally, setting everything up using a staging site will be the best.

Now start by installing and activating the plugin from WordPress.org. Later, go to Tools > Child Themes for creating your own child theme. Then, from the Select A Parent Theme drop-down menu, you need to select the theme for which you wish to create a child theme. Once done with this, click on Analyze.

For any of the dependencies, the plugin will start analyzing your parent theme. After this, you will see many additional settings. Leave them as default if you are unsure what a particular setting means. After you are done making all your choices, click the button present at the bottom to Create New Child Theme.

This is how the plugin will help you create a child theme. You further need to activate the child theme.

For Activating a Child Theme:

  • you need to go to Appearance > Themes
  • Preview what your site looks like
  • then activate the child theme just like you would activate any other WP theme. And throughout the process, make sure that your parent theme is installed.

This plugin has some other useful tools for managing your child theme. For instance, you can edit the single.php, then you can copy it to your child theme and later edit it safely. Likewise, there are tools to work with the CSS.

How To Create A Child Theme Manually

For creating a child theme manually, it is expected to know a little bit about PHP and CSS.  To create a child theme, you will have to create two files:

style.css – at the beginning, you will have to add some boilerplate code.

functions.php – with this, you will be able to enqueue the stylesheet from your parent theme. Your child theme will not be able to apply the parent’s theme CSS without this.

Create a file named style.css and put the following code.

/*

Theme Name: Bakery Child Theme

Theme URI: https://www.vwthemes.com/themes/bakery-wordpress-theme/

Description: Bakery Child Theme Created For customization

Author: VW Themes

Author URI: vwthemes.com

Template: Bakery

Version: 1.0.0

*/

Be sure to release the content that comes after the colons with information regarding the theme you are using.

Theme Name: this is the name of your child theme.

Theme URI: website for the theme and documentation.

Description: description of your theme in short.

Author: theme’s author’s name

Author URl: theme author”s site.

Template: this is most important since your child theme won’t work without this. It is the name of your parent theme’s folder.

Version: Version of the child theme.

For adding your own custom styles in near future, you can do it by adding this stylesheet below the boilerplate code.

Functions.php

The next thing you need to create is the functions.php file for your child theme. For enqueuing the full CSS stylesheet from your parent theme, this will help you.

Just add the following code in your functions.php file:

<?php

/* Function to enqueue stylesheet from parent theme */

function child_enqueue__parent_scripts() {

wp_enqueue_style( ‘parent’, get_template_directory_uri().’/style.css’ );

}

add_action( ‘wp_enqueue_scripts’, ‘child_enqueue__parent_scripts’);

Uploading The Files To Your WordPress Site

As discussed above, you will be able to create the style.css and functions.php file. After you have created these two files, the next thing you need to do is to upload the files to your WordPress website in the form of a new theme.

In order to do so, you need to use FTP to connect to your WP site. After this, just browse the theme directory of your site (wp-content/themes) and make a new folder for your child theme.

After creating the folder, you need to upload the style.css and functions.php file into that folder. After you are done uploading both files, you can now go to Appearance > Themes and then activate your child theme.

Customizing Parent Theme Using A Child Theme

The main purpose behind creating WP child themes is to customize the parent themes. If you need to customize a file named subject.php, what you need to do is, you need to copy that file to the child theme first. After this, you can carry out the desired customization in that file so as to keep the codes in the original file unchanged. Technically speaking, you need to create the same path for the files and folders in the child theme by referring to the parent theme. If this is not then there is a possibility that the changes you do might not be reflected.

To Conclude:

WP Child Theme serve as a perfect and super-efficient tool used for customizing your WordPress websites. It is always recommended that one should make a child theme before making any modifications to the site by modifying the actual files in the original theme. For those who are not advanced-level developers and are not aware of the coding part, then it is much easier to install and use the plugin and then easily install the child theme. This article might have explained everything regarding the creation of a child theme and its activation for using it for your website.