How To Make a Child Theme From Scratch in just 2 minutes ?

Spread the love

 

Table of Contents

What is a Child Theme? And Why We Use It?

 

When We Talking About Child Theme, Firstly We Want to Know About Parent Theme. A Theme Can Be a Parent when Someone Builds a Child Theme For It.

A Big Difference Is that “Child Theme Is Totally Depend on The Parent Theme in Order to work.” Without Parent Theme, Child Theme can’t Work or Even Can’t Activate.

Child Theme Uses Everything Present in Parent Theme and Change Only Those Part That Which You Want. This Allows You to Customize Styles, Layout, Functions, Templates & Much More.

Why do You Need to Create a Child Theme?

Child Theme is the Best Way to Customize a WordPress Site Easily. You Can Customize it Without Affecting Your parent Theme.

 

 

Creating a Basic Child Theme

  • Creating wpw3demo Folder

First You Need to open htdocs/folder Name/wp-content/Themes in Your WordPress Installation Folder. You Can Name This Folder Anything. In This Tutorial, We Are Naming It as wpw3demo. In This Tutorial, We Will be Using Twenty Seventeen.

How To Create a WordPress Child Theme
  • Creating a Style.css

Open a Text Editor Like VS Code or Notepad etc. and Paste these Code. In This Tutorial, I’m using the Visual Studio Code (VS Code). Below is an Example to Create a Style.css in Your Child Theme Folder.

How To Create a WordPress Child Theme_

Now Save This Code to Your Child Theme Folder as Style.css.

  • Writing a code

 

<pre class="wp-block-syntaxhighlighter-code"> /*
Theme Name:   wpw3 Child Theme
 Theme URI:    https://www.wpw3schools.com/
 Description:  A Twenty seventeen child theme 
 Author:       wpw3schools
 Author URI:   https://www.wpw3schools.com/
 Template:     twentyseventeen
 Version:      1.0.0
*/
 
@import url("../twentyseventeen/style.css");<br /><br /></pre>
  • Go to Your Website

This Code Tells WordPress that Our theme is a Child Theme and our Parent Theme Directory Name is Twentyseventeen. Now the Parent-Theme is very Sensitive.

The Last Line of Our Code is used to import Our Parent Theme’s StyleSheet to a Child Theme.

Now The Next Thing is That You Can now go Appearance > Themes Where You Will See The wpw3 Child Theme. Now We Have to Start This Child Theme So Then Click on Activate Button on Your Site.

How To Create a WordPress Child Theme

Since You Haven’t Changed Anything in Your Child Theme Then WordPress By Default Use all The Functionality and Appearance Of The Parent Theme.

  • Screenshot

Now Here is One Thing i.e; if you Want to add any pic on Your Child Theme Then here is a Step by Step Process below.

Firstly go to Your Folder like this.

htdocs/folder Name/wp-content/Themes/wpw3demo .

Now The Next Step is to choose any one Image Which You Want. And When You Put The Image into wpw3demo. Then Rename That Image and Write it as Screenshot.

How To Create a WordPress Child Theme
  • Go to your Website

Here You can Choose any Image But Naming Of The Image Must be the Only Screenshot. After This, You Can now go to Appearance > Themes Where You Will See The Image that which You Put Into The wpw3demo.

How To Create a WordPress Child Theme

Hope You Like this article and it will help you to create WordPress Child Theme From Scratch. During This Creation of Child Theme if You Getting any Problem Please Contact Us or Comment Below.