How to Create Child Theme in WordPress – Tutorial for Beginners
Do you want to create a child theme in WordPress? But if you are not sure how to do it, then reading this post can be helpful for you. Sometimes making intended changes to your existing WordPress theme may lead to some unpleasant changes. Of course, that won’t be beneficial for your business and brand. In this step by step guide, I will walk you through the steps to create a child theme in WordPress. So, let’s dive in!
One of the most popular ways to customize a WordPress theme is to create a child theme of an already existing/installed theme. While you can quickly create a WordPress theme with the best WordPress theme builder in the industry. However, a child theme in WordPress is one of the easiest ways to enhance your theme. That too without any risk of messing up your design at all. When you pick up a WordPress theme for your website, chances are it does not include all desired features. Or with time, when your business grows you feel like adding some new features to it.
What would you do then? Will you directly edit your WordPress theme and will take the risk. Or you would go for some other simplest way that doesn’t involve much complexity. Well, that’s exactly where the concept of a child theme comes into play. Making customization without hampering the original template files. Because making certain changes in the template files is a big thing that involves the highest threats.
It’s your choice whether you wish to create a child theme manually or with the help of a plugin. In this guide, I have covered various aspects related to a child theme in WordPress. So, feel free to quickly navigate to any part of this tutorial.
What is a Child Theme?
A child theme is a theme that inherits the properties, look, appearance, and functionality of the parent theme. Whenever you make any changes to the child theme they are stored separately from the original parent theme files. In other words, a WordPress child theme enables you to make changes in the functionality of the theme without disturbing the original code files. Basically, a child theme saves you from damaging your already running website by editing your theme template. Since the child theme is saved independently, it does not require any redo the changes next time whenever you wish to upgrade the theme. It is to note here that if you have some prior basic knowledge such as creating PHP files, file upload, code modification, etc. that will help you configure a child theme seamlessly.
Creating a child theme WordPress should be a breeze. Because WordPress is the most famous and widely used content management system available out there. Right from the very beginning when you install WordPress to other things such as installing WordPress theme, installing a WordPress plugin, delete the theme in WordPress, changing the WordPress admin color, export or import users on a WordPress website, to almost anything you may think of. Working with WordPress is always a treat.
It provides you the flexibility to explore all the possible areas. Furthermore, you can extend the functionality of your WordPress website to a great level with the help of WordPress plugins.
How to Create a Child Theme in WordPress – Basic Terminology
Before we move any further, I assume you understand WordPress and its capabilities. Whereas, few of you might be comparatively new to the WordPress ecosystem and website building. Therefore, it is crucial to get familiar with some of the basic and required child theme WordPress terminologies. A bit later, here at TemplateToaster WordPress Theme Generator blog, I will get into technical details too.You may create it by yourself or download the best WordPress themes or free WordPress themes from any reliable source So, let’s begin!
WordPress Theme
It refers to any collection of stylesheets or scripts that contribute to the layout and structure in general. It also defines the design and display of the WordPress website. You may create it by yourself or download the best WordPress themes or free WordPress themes from any reliable source.
Parent Theme
If you are using a predefined theme designed by any author, then the very first copy of it becomes a parent theme. However, when newer versions of the same theme are subsequently released, you also need to upgrade them. Hence, what you basically update is your parent theme’s code.
Child Theme
This is the sub-theme that is created to prevent changes in appearance due to parent theme modifications. You can keep your custom modification’s code, custom HTML, and CSS files in the child theme, it’ll override the main theme’s functionality and styling. The Child theme is created keeping in mind the capability for future modifications. It inherits the functionalities of the parent theme. To modify the existing theme, this is the safest way recommended by WordPress.
How to Create a Child Theme in WordPress Manually
Now, after going through the different and important terminologies, let us now head towards the steps to manually create a WordPress child theme. It is to note here that a child theme folder should have functions.php and style.css files. However, WordPress code snippets can be used in different ways to enhance the functionality of your website. So, this is the time to have a look at various codes and steps involved in creating a child theme WordPress.
Steps to Create a Child Theme in WordPress – Overview
First off, create a child theme folder in the theme directory. Secondly, the name of the child theme folder should be defined in the pre-described format only. It is Parent Theme name-‘child theme name’. So, this is the suggested naming practice you should follow.
Well, the next step is to create a CSS file. By editing CSS in WordPress you can easily customize your WordPress theme. Moreover, it helps you accomplish all the design-related goals with which you want to modify your theme as per your requirements. I am using the name ‘style.css’. However, the styles written in this file will control the overall look of your WordPress theme.
After you have successfully created the child stylesheet. Next, you need to enqueue (calling/embedding a file is called enqueue in WordPress) the created child theme stylesheet. The use of @import was quite common in the past. However, it is no longer a recommended practice now. The currently in use practice is making use of a ‘wp_enqueue_scripts action’ in the function file functions.php. Don’t worry I will explain that in the latter part of this post in more detail. For now, know that you would need this.
So, now you can add the desired code to your child theme files and activate the child theme. You can add/edit the template files and use the ‘functions. Php’ function file. However, all these functions, styles, and code will flawlessly override the parent themes functionality.
What are the prerequisites to create a WordPress Child Theme?
The creation of a child theme is possible only when there is a parent theme already installed. In case you are creating your very first child theme, then you should know how to install a WordPress theme properly. So that there should be no errors due to this. Are you a beginner who has just created a WordPress website on a local PC? you can move the WordPress site from localhost to a live server once you are ready with your theme development. With the help of that, you will be able to install a theme and create a child theme of it thereafter. You may also learn how to create a WordPress page template, create a church website and create a one-page website.
Create & Customize a Child Theme in WordPress: Step-by-Step
Now, you know the process. But if you are thinking about how to bring it into reality. Then this further explanation will help you understand that. I will show you exactly how the implementation of the above-discussed steps will take place. We will get into a wider perspective and see how everything is adding value to your child’s theme. I am sure after going through the following elucidation, you will be all set to do it on your website too. So, let’s get started now!
Step 1: Add Code Inside Child Theme Stylesheet
The code inside the child theme stylesheet has to be something like the format as under
/* Theme Name: TemplateToaster Child Theme URI: http://example.com/wordpress-theme-child/ Description: WordPress Child Theme Author: Mike Davis Author URI: http://example.com Template: TemplateToaster Version: 1.0.1 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready Text Domain: templatetoasterchild */
Here, you need to keep in mind that the theme name should be unique and different. Besides that the field ‘Template’ should be named the same as the parent theme directory. However, using TemplateToaster to create a website will help you make a beautiful design in no time at all. On the other hand, you might be working with a different theme name differently, so you can change the name accordingly.
Step 2: Create and Use the Function File
As discussed earlier, the use of wp_enqueue_scrpits action as well as wp_enqueue_style() for the child theme is advisable. The functions.php file is needed to enqueue in both the parent and child theme stylesheets. Therefore, you are required to create a functions.php file in your child theme directory. However, the complete structure of the code will be something as follows. This is to note here that several parts of the code may vary based on the changed value you may have in your theme.
<?php add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); function my_theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); }
As you can see in the above code, the very first line contains an opening PHP tag (</php). I assume you know what PHP is? Well, moving ahead, the code to enqueue your parent and child theme stylesheets can be added proceeding that. A fact worth noticing here is to keep in mind while using ‘functions.php’ is that, unlike style.css, it over-writes the parent theme code instead of overriding it. Furthermore, you can view a sample code representing a pattern of editing the code in your functions.php file as shown below.
<?php // Opening PHP tag - nothing should be before this, not even whitespace // Custom Function to Include function my_favicon_link() { echo <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />' . "\n"; } add_action( 'wp_head', 'my_favicon_link' );
This is the sample code where a custom function is created to contribute some additional characteristics to the theme. Thus, it is proven that editing the code directly into your functions.php file is pretty simple. Moreover, it is the fastest and the smartest way in case you want to add any functional modifications to your theme. You are free to add whatever code you wish to add to the functions.php file here. It will be added to the functionality obtained through the main PHP code.
Step 3: Activating the Child Theme
Once you are done with the modifications. And your child theme is ready, there won’t be any hard steps to activate it. It will be a cakewalk. However, there are not many steps to activate a child theme. All you have to do is:
- Firstly, log in to the Admin Panel of your site.
- Secondly, go to Administration Screen → Appearance → Themes.
- Lastly, you should see your child’s theme listed there. It should be ready for activation. Now, you can simply click on the activate button, and Voila! You shall now see your child theme at work. Each and every modification will be at the expected place. And rest everything else should also work and look in the layout of your website as intended.
How to Create a Child Theme in WordPress Using Plugins
Yes, you may use WordPress plugins to create a child theme. Yes! This sounds like the easiest way to do so. However, if you have some knowledge of PHP, CSS, JavaScript, that can help you bring the desired results in minutes without a hitch. Well, moving ahead, I will introduce you to the top-notch WordPress plugins that can help you configure a child theme on your WordPress website. For creating WordPress theme most popular is W
There are thousands of free plugin solutions available in the WordPress plugins repository. However, with the availability of a wide range of plugins, you should also keep in mind that not every plugin is useful for your website. So, know which WordPress plugins you need right now and how many plugins you need for your website. Let’s see which plugins are highly useful when it comes to creating a new child theme. Here we go!
1. Child Theme Configurator
Child Theme Configurator is a rapidly growing WordPress plugin. It enables you to analyze any WordPress theme for all the common problems. However, the basic use of this WordPress plugin is to create a child theme and you can easily customize it however you like it. The best thing about this plugin is that it allows you to directly customize child theme stylesheets. Also, overriding the CSS attributes is also possible with the Child Theme Configurator WordPress plugin. It rightly enqueues theme and font stylesheets for optimized performance.
Key Features of Child Theme Configurator
- Child Theme Configurator automatically determines the right way to set up a child theme depending on the WordPress theme you are using.
- It lets you find the exact matching style selector similar to your theme. Hence changes the properties accordingly.
- Right from the WordPress admin, you can locate and edit theme templates from admin.
- You can easily use web fonts on your website.
- It provides multisite compatibility.
- Editing theme CSS is pretty simple with Child Theme Configurator.
- You can easily export the child theme as a zip archive.
- It allows you to customize media queries for responsive designs.
2. Child Theme Generator
Child Theme Generator is another brilliant solution that you can use for your WordPress website. With the help of this plugin, you can easily create a child theme. However, the major benefit of creating a child theme is to try out all new features and make further changes. Also, it removes the need of overwriting any of the parent theme files. After you have successfully created your child theme you can easily remove the plugin from your website. All-in-all it’s pretty easy to use this plugin for your website.
Key Features of Child Theme Generator
- It is an easy-to-use WordPress plugin.
- It beautifully inherits the parent theme’s properties.
- Thousands of users are using this WordPress plugin.
- It will not slow down your website in any way.
- It comes with a 4-star rating.
- Child Theme Generator is available in 13 different languages.
There are various other free as well as paid WordPress plugins that you may use for your WordPress website. The purpose of mentioning the above WordPress plugins is to let you know what are the leading WordPress choices.
Creating a Child Theme WordPress – In Conclusion
So, this brings us to the end of this how to create a child theme in a WordPress tutorial. I am sure by now you must have realized how significant it is to create a child theme on your WordPress website. WordPress is a feature-rich platform. That provides you incredible ways to create whatever type of website you want. Also, when you wish to add some new functionality to your website, it is suggested that if anything new you wish to introduce to your WordPress website make use of a child theme.
However, there are two methods to create a child theme WordPress. Also, creating a WordPress child theme is by far one of the safest ways to modify your WordPress website template. Whenever you want to have a new look you can simply modify the code in the child instead of modifying the parent code all over again. Hence, the data on your website remains safe even if you are updating your website with an upgraded WordPress theme. Make sure you always remember the way to find the WordPress login URL.You can read our other articles if you need to know how to change the WordPress language of your theme, customizing your WordPress dashboard, etc. Let me know in the comments if you still have any confusion regarding the WordPress Child Theme Creation process and I will try to help you further.
Build a Stunning Website in Minutes with TemplateToaster Website Builder
Create Your Own Website Now
If you are a beginner, it is best to use ready-made wp theme with a child theme.
Can i create grandchild theme?
This is the best way to guide the beginners. Keep it up!
I love the way of mention everything in detail. It is very helpful for me to know about new things.
Beginners need help at every step to create new themes and plugin as well. I really appreciate you for providing such a wonderful article.