How to create a child theme in WordPress ?


How to create a child theme in WordPress

Adding a child theme in WordPress is a very easy process and a user with little knowledge of html and php can create child theme in WordPress.

We will discuss this process step by step here.

Step 1 to create a child theme in WordPress:-

Identify the current theme for which you are looking to create a child theme. Once you know the theme, in wp-content/themes/ create a folder named parent_theme-child ( here parent_theme is the name of the main theme e.g if theme name is “Yuvi” them child theme folder name will be “yuvi-child” ).

Step 2 to create a child theme in WordPress:-

Now create two files named style.css and  functions.php in Child theme folder which we you have create.

Now add these below codes in style.css file

/*--

Theme Name: Yuvi Child
Theme URI: https://your-domain.com/yuvi-child/
Description: Yuvi Child Theme
Author: Yogiraj
Author URI: https://www.yogiraj.co.in
Template: yuvi
Version: 0.1
Tags: Best theme, full width, with sidebar widget
----*/

/*---------- You can add custom css below------------*/

In above details WordPress only requires Theme Name (name of child theme) and Template (name of parent theme), rest all details are optional.

Step 3 to create a child theme in WordPress:-

Now we need to connect parent style.css file in child theme. Add below codes in function.php file which you have created in child theme folder.

<?php
function yu_enqueue_styles() {
wp_enqueue_style( 'yu-parent-style', get_template_directory_uri() . '/style.css' );
}
add_action ( 'wp_enqueue_scripts', 'yu_enqueue_styles' );

Once yo add these codes, the child theme is successfully created and ready to use. You will find it in Appearance>Themes and can activate it.

Child theme is very useful in WordPress and very important also. It helps to customize a theme without loosing that customization on future updates. If you customize a theme without adding a child theme then you will not be able to update that theme in future, otherwise all the customization will be lost.

Always do all customization using a child theme and keep theme update to date.

Share on: Share YogiRaj B.Ed Study Notes on twitter Share YogiRaj B.Ed Study Notes on facebook Share YogiRaj B.Ed Study Notes on WhatsApp
Unit Plan
Q. Unit Plan

Definition – “A detailed plan on how a particular topic will be conducted, including pupil activities, and to meet the objectives.”.
Principles to keep in mind –
Why to teach – Objectives.
What to teach – Content…

Read full article
The principles of effective teaching
Q. The principles of effective teaching.

Being an effective teacher is much more than simply having the right materials. Effective teaching means maximizing communication and developing great presentation skills. While teaching involves innumerable skills and traits, a few basic principles can be distilled for the teacher in-training.

Read full article

Some important study notes