WordPress child them

If you have ever used a WordPress theme or thought of creating a one then you will definitely be aware of using a child theme on your website. If you are a beginner in this, then no problem we have got all covered for you. In this article, we will let you know about child themes and How you can create one yourself. Let’s get started with this tutorial of Creating WordPress Child Theme.

What is a Child Theme and why you need it?

A child theme is a WordPress theme that inherits the functions of another theme that is the Parent theme. Child themes are like a duplicate of parent themes. You need a child theme in order to do all the customization or tweak on an existing WordPress theme. A WordPress child theme is mainly created to make changes in your existing theme so that you do not lose any data when you update your theme. This is the safest means as there is no chance of losing or deleting of your data when your parent theme is updated. So child theme becomes really important for your website. You can easily modify just what you need without disturbing your parent theme.

How to create a WordPress Child theme?

Creating a WordPress child theme is not a very complex task at all. Even if you are a beginner you can easily create a child theme.
In order to create a Child theme, you will just need:

  • A text Editor so that you can edit the theme files. You can use Sublime, Notepad etc.
  • FTP Client or Local Development Environment: You will require FTP login to access your server for a live site. You can also do it on a staging site on your local server and make it live later.

Let’s get started:

You will firstly need a good WordPress theme that can be used as a parent theme. In this article, we will be using Reign BuddyPress Theme.

Step 1. Open the /wp-content/themes/ in your WordPress theme folder. Here create a new folder and name it as “reign-child”. So the new child theme directory will be wp-content/themes/reign-child.

Step 2.  Open any text editor like Notepad and paste this code:

/*
 Theme Name:   Reign Child Theme
 Theme URI:    http://yourwebsite.com/reign-child/
 Description:   Reign Child Theme
 Author:   Wbcom Designs
 Author URI:  https://wbcomdesigns.com
 Template:   Reign
 Version:      1.0.0
*/

Step 3: Save this file as style.css in the folder you created.
Keep in mind the “template” of the theme. Make sure that this parameter correctly identifies the directory name of your parent theme that is “Reign”. The parent folder name is case-sensitive. The theme Name, URI, Description, and Author are totally up to you. You can customize this header info accordingly.

Enqueue Your Parent Theme Stylesheet

In order to make any changes in the style.css file of the child theme, we need to make sure we use Reign Parent Stylesheet first and then introduce our new stylesheet after. Since if you do not do this, the code you enter at the bottom will always take precedence over the code at the top.
In order to do this, we will use the text editor to create another file within the child theme folder. Save the file with the Name functions.php (the name must be exactly this) and then add the following code to the file:

<?php
function my_theme_enqueue_styles() {
wp_enqueue_style( ‘parent-style‘, get_template_directory_uri() . ‘/style.css‘ );
}
add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles‘ );

Now save the file.

Zip the folder and upload it to your website from Dashboard>> Appearance>>Themes>>Add New.

Activate the theme.

So, this was a basic tutorial on how you can create a child theme of your own. Following this tutorial, you can create a child theme and upload it on your website.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

logo