Are you searching a safer way of modifying your WordPress Theme? Creating a child theme in WordPress is the most effective way to add custom functionality. Moreover, having a child theme can make your work more efficient and much faster development time. Taking this into mind, in this article we will describe how to create a child theme in WordPress.

So, let’s get started!!!

What is Child Theme?

 A child theme is basically a wordpress theme which follows all functionalities of its parent theme. It helps you to customize your theme without affecting the main theme.You can add some new features or functionalities including the parents theme features.Furthermore, you can reverse any changes that you have done by easily disabling it.

One of the most important benefits of having a child theme is that even your parent theme gets updated, you modify it in the child theme retain on the updated version. Also, with a child theme, it’s quite easy to keep track of the modification that you have done in your theme. 

Why You Need to Create a Child Theme in WordPress?

There are several reasons you have already realized the importance of creating a child theme in your website. Some other advantages are given below :

  • A child theme speeds up your site development time.
  • It allows you to easily update your parent theme without affecting your modification.
  • As it helps to keep track of your changes, it is much easier to find errors in your theme.

How To Create A WordPress Child Theme?

Before getting to the step of creating a child theme, you must follow some requirements so that you can do it properly.

First, you have to familiarize yourself with HTML/CSS knowledge so that you can understand the basic syntax and its function. Besides, having some PHP knowledge will also help you to make your changes on your own.

Now, after having these requirements, start your journey to create a child theme. Here we will be given describe each step in details below:

Step1: Create a new folder for your child theme in your theme directory

In the first step, open your WordPress installation folder via an FTP client like Filezilla. For this, go to (../apps> wordpress> htdocs>/wp-content/themes) and create a new folder on the theme folder. You can name it as you like to remember. We will suggest you use as the parent theme plus child added on the end.

For example,  if we are using Twenty Thirteen, then the folder name will be like Twenty sixteen-child.

create new folder for child theme

Step2: Open a Text Editor and Paste Code

Now, in the 2nd step, go to the new folder that you have created now, then open a text editor like Notepad here and paste the following code on that.

/*
Theme Name: Twenty Sixteen Child Theme
Theme URI: https://www.example.com
Description: A Twenty Sixteen child theme
Author: Author name
Author URI: https://www.example.com
Template: twentysixteen
Version: 1.0.0
*/
paste code in text editor

After pasting the code on the text editor, save the file as style.css in the child theme folder. With the code, you just simply import the stylesheet of the parent theme to the child theme. 

Step 4: Create functions.php file For Your Child Theme

The style.css will control the style and layout of your website but the functions.php allows the addition of advanced functionalities and customisations to the themes. For this, you need to create a functions.php file in the child theme folder. If you add a new feature and function in the parent theme’s functions.php  file, that means whenever a new update is available to your parent theme all changes will be overwritten. So, it is recommended that you add all your custom code snippets into the child theme’s function.php file.

To do that, again go to your child theme’s folder and create a  new text editor file as functions.php. In the functions.php file, add the following code:

<?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’);
?>
create functions.php file for child theme

Step 5: Activate Your child Theme from WordPress dashboard

Now, in the 3rd step, you need to go to your WordPress dashboard and then navigate Appearance » Themes. Here you will now view your child theme. You just need to activate the theme by clicking the Activate button. Now, your child theme is ready, it’s time to customize it properly.

activate child theme in wordpress

Step 6: Customize Your Child Theme

This is the most interesting part as here you can customize your theme design as you want. WordPress allows you to customize your theme as you want quickly and easily. When you activate the child theme, you will see another option on the theme as customize. You just need to click on the customize button. After clicking on it, we will the WordPress builtin customize options. Here you can customize your theme site identify, colors, header image, menus, widgets, home page settings etc. For more details of how to customize your theme read the article about How to Use WordPress Customizer.

wordpress customization options for the child theme

For customizing, we will suggest another solution to customizing your theme. Nowadays Gutenberg Blocks and Page Layouts – Attire Blocks on WordPress is the best drag and drop page builder that easily does your work. With it, you can create custom templates for your sites. It will also work both for parent and child themes.

wpattire block

Most interestingly, you can customize your design without writing any code. You just do everything with the drag and drop features.

This plugin provides you with the following blocks for your page building such as,

That’s all. Now your turn. Customize your child theme as you want and make it ready to go for a journey.

Conclusion

In summary, For safely making changes to your WordPress theme, creating a child theme is the best solution. Building a child theme is very simple and fun and provides you with the security of reserving the customization of your theme design and layout.

Hopefully, this tutorial helps you to understand how to create a child theme in WordPress. To learn more about WordPress tips & tricks, you may check our WordPress Tips section.

You may also ask any questions related to it in the comment or want us to write on some specific topics you have in your mind.

We appreciate your further comments, support or suggestions!

How To Create A Landing Page With WordPress?
WordPress Multisite: A Detailed Guide

Leave a Comment

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