0% found this document useful (0 votes)
50 views

How To Create A Child Theme in Wordpress

Do you have a WordPress website and want to do some customization in the theme file? But don't do that directly. I would suggest you create a first child theme then use it for your customization.

Uploaded by

Aman Mehra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

How To Create A Child Theme in Wordpress

Do you have a WordPress website and want to do some customization in the theme file? But don't do that directly. I would suggest you create a first child theme then use it for your customization.

Uploaded by

Aman Mehra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

HOME BLOG CATEGORIES  CONTACT

HOME HOW TO HOW TO CREATE A CHILD THEME IN WORDPRESS?


RECENT POSTS

How to Check String Contains a


Specific Word in PHP?
How to Create a Child Theme in WordPress?
How to Create a Child Theme in
AMAN MEHRA MARCH 28, 2021 LEAVE A COMMENT
WordPress?

Tweet on Twitter Share on Facebook How to Install WordPress Plugin


Step by Step Guide 2021?

How to Create a Custom Page


Template in WordPress?

How to install React-Router and


use it?

CATEGORIES

How To

PHP

ReactJS

WooCommerce

WordPress

If you are satisfied and love your current active theme and want to do some changes in the theme files. MOST VIEWED POSTS
So in this case you need to create a child theme in WordPress and you will learn in this article how you
WooCommerce Remove Update Cart
can create it. button and make it automatically
What is Child Theme? update.
October 5, 2020

Before you know about the child theme, you must know about the parent theme. Parent theme is a
complete theme which have all the template files, base files, and assets file. You can also make changes How to change price of
in the parent theme, but it’s the wrong way to modify the themes file. And of course, you will lose your all specific product and
quantity in cart?
changes in the parent theme when you updated it. So, we will learn below why it’s important to create a
October 14, 2020
child theme in WordPress.
How to redirect to
checkout after Add to
Child theme is an alteration of parent theme. It will inherit all characteristics and functionality of the cart?
parent theme. It will allow you to make changes in the file without touching the parent theme’s original October 16, 2020

files.
How can I prevent SQL
injection in PHP?
Why you should create a child theme in wordpress? October 7, 2020

A child theme is very important to create when you are going to modify some files of the parent theme. Upload multiple featured
images in a post OR page
As we mentioned above it will inherit all the functionality of the parent theme and create a new separate
January 4, 2021
theme. You can make customization and changes in this theme instead of the parent theme and keep
changes safer while updating the parent theme.

You will not lost your modification data


FOLLOW US
Keep modification file separate from parent theme Stay updated via social channels

Make customization portable, you can keep record of modification files

Great step to learn theme development

It will take over the functionality of parent theme and you don’t need to start from scratch

Structure of Child Theme

In the child theme, you can copy all the files from the parent theme and create a custom template, but I
will recommend you to put the required files into the child theme folder. But there is also a required that
must-have in the child theme folder.

Files in Child Theme:

functions.php (required)

style.css (required)

screenshot.png (optional)

Any other files/template are optional

Let’s start with creating a child theme.

Create a Child Theme in WordPress

There are 2 methods to create child theme:

METHOD #1

Create a Child Theme in WordPress Without Plugin

Before creating a child theme without plugin, you can do it on your localhost (XAMPP) and then upload
on your live server through FTP or File Manager in cPanel.

If you still want to do it online then follow these steps:

You need FTP access details.

Login to your FTP account and Navigate to “/wp-content/themes“. I’m following to use free
twentytwentyone theme but you can select your theme. Check here for best free theme

Create a new folder like “twentytwentyone-child“. You can take another name but I recommend that
the folde name should be similar as parent theme folder name for more clarity.
Now, open this folder and create a “style.css” file with the following code.
/*
Theme Name: Twenty Twenty One Child
Theme URL: http://yourdomain.com
Description: This is the child theme of Twenty Twenty One
Theme Author: Your Name
Author URL: http://yourdomain.com
Template: twentytwentyone
Version: 1.0.0
Text Domain: twentytwentyone-child
*/

You can change the value of these fields as you want but keep in mind that, the Template field is very
important. It will be your parent theme’s folder name as you can see above in the code. This Template
field tells WordPress relation between child and parent theme.

Create another file “functions.php” in the same folder. You will see both files like this.
Now, we will enqueue the parent and child theme stylesheet with this function wp_enqueue_style().
Add the following code in the “functions.php” file to enqueue stylesheet. It will load the parent and
child theme stylesheets:

<?php

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );


function my_theme_enqueue_styles() {
$parenthandle = 'parent-style';
$theme = wp_get_theme();
wp_enqueue_style( $parenthandle, get_template_directory_uri() . '/style
array(), // if the parent theme code has a dependency, copy it to
$theme->parent()->get('Version')
);
wp_enqueue_style( 'child-style', get_stylesheet_uri(),
array( $parenthandle ),
$theme->get('Version') // this only works if you have Version in th
);
}

?>
Goto your admin dashboard and Navigate to Appearance -> Themes. You will see your child theme is
there and you can activate it by clicking on “Activate” button.

Now test your style appearence at frontend. If you found any error, ask me in the comment section.

METHOD #2

Create a Child Theme in WordPress with Plugin

Yes! you can create a child theme with a plugin. If you are a beginner then I will recommend you to use
this method to create a child theme to avoid any errors. It is a very simple method, you just have to click
on one button and it will create a child theme for you. It will copy all the required files from the parent
theme and put them in the child theme folder.

There are a lot of child theme generator plugins in the WordPress directory. You can search any of one
but I’ll suggest you this one child theme creator. I also have used this and its really simple interface.
Select that theme for which you want to create a child theme and click on the “Create Child Theme”
button. It will create a child theme in just a second for you. There are two checkboxes, you can check
them if you want to do.

Hope! you like this article, please feel free to ask me any questions related to coding in the comment
section. I’ll give you my best solution for any query. Good luck with your child theme. Happy Coding 🙂
CHILD THEME CREATE CHILD THEME HOW TO MAKE CHILD THEME WORDPRESS CHILD THEME
WORDPRESS THEME

Tweet on Twitter Share on Facebook

YOU MAY ALSO LIKE

How to Check String Contains a How to Install WordPress Plugin How to Create a Custom Page
Specific Word in PHP? Step by Step Guide 2021? Template in WordPress?
How to install React-Router and How to install reactjs and How to get WooCommerce
use it? create a app? order details?

ABOUT THE AUTHOR: AMAN MEHRA


Hey! I'm Aman Mehra and I'm a full-stack developer and have 5+ years of experience. I love
coding and find solutions to bugs.

LEAVE A REPLY

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

Comment
Name * Email * Website

Save my name, email, and website in this browser for the next time I comment.

POST COMMENT

ABOUT QUICK LINKS RECENT POSTS JOIN OUR NEWSLETTER

Your Blog Coach is the best site for Home How to Check String Contains a Name
finding the solution to any issue related Specific Word in PHP?
Blog
to coding and learn more cool stuff
How to Create a Child Theme in
and tricks. WordPress Email
WordPress?
WooCommerce
How to Install WordPress Plugin Step
Contact by Step Guide 2021?
SUBSCRIBE

© 2020 Your Blog Coach Privacy Policy Terms and Conditions Sitemap

PDFmyURL.com - convert URLs, web pages or even full websites to PDF online. Easy API for developers!

You might also like