How to create a wordpress child theme

how-to-create-a-wordpress-child-theme
Spread the love

In this article I will explain of few things about wordpress child theme.

  • Why we need to use wordpress child theme?
  • What will happen if we don’t use child theme?
  • How to create a child theme?

Here are few questions about wordprss child theme,A developer who just started using wordpress he really don’t know about child theme of wordpress.
If he heared about child theme he must wanted to know what is this ?

1 What is wordpress child theme
First of all you need to know what is child theme. WordPress child theme is a Replica or a Mirror Image of a WordPress theme which you are using in your wordpres websie.(A theme which is activated at the moment).
Child theme – It means it’s should have a parent theme, if your parent theme is nota available then child theme will not work because chiled theme inherits every funcitonalities from it’s parent theme.
In other words we can say child theme will work properly if you have a parent theme exists.

2 Why we need to use child theme ?
Another question comes in mind why we need to use a child theme if we already have theme in our website.
I’ll tell you why is this – Just beacuse if you customise wordpress theme chaning color of menu, adding custom code to the website or maybe designing a custom forms for all this you will have to write your own custom code to the wordpress.
Did you ever think beyond all of this that you hard work can be lost. How ??
if you update your theme this will replace to is real coding with new updates in the code file. Code, css, html anything added by you will completly lost, Which is a Big Headacche for you. To overcome to this problem you need a child theme, beacuse every changes you do in the chid theme will never go anywhere even you update it’s parent theme. This is the main reason to use child theme.

3. How to create a child theme ?
Finally you know about child theme, as you have read in this article. Now you must be thinking how to careat
a child theme. Creating a child them is very easy it can be created manually or you can use a plugin for this.

Manually create a child theme
It’s requirments:- You will have to check if you have parents theme already. if you don’t have child theme will not work as i’ve mentioned above in this article.
Step 1: Create a Folder and give it a Name as you like, example : – W3contents child
Step 2: Create a Css File inside the child theme and name it style.css
Step 3: Open the Style.css and paste the Following Code the file.

/*
Theme Name: W3contents Child
Template: W3contents
*/

Step 4: Create a Functions.php file inside the child theme folder and paste the following code to it.

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

Step 5: Now Zip the Child theme folder and upload it via Appearance -> Themes -> Add New
Step 6: Finally Activate child theme and you are done.

Create child theme using plugin:
There are many plugins available which helps you to create child them, for example – One-Click Child Theme, Child Theme Configurator, Child Theme Creator by Orbisius etc.
Now I’m gonna explain how to create a child theme using One-Click Child Theme plugin.
Follow instructions step by step to create a child theme.

Step 1: First Go to Plugins -> Add New Then Search for Plugin “Child Theme Configurator”
plugin-install
Step 2: Activate this plugin.
Step 3: Go to the Tools then click on child themes.
plugin-install-2

Step 4: Select an option -> Create a new Child Theme, then choose your theme from dropdown.
plugin-install-3

Step 5: Analyze your theme.
plugin-install-4

Step 6: Finally Create your child theme and Activate it.
plugin-install-final

If this article found helpfull for you, Please let me know by leaving you comments below and don’t forget to share with your frineds. Who is just in with wordpress development.

Leave a Reply

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

WP Twitter Auto Publish Powered By : XYZScripts.com