Theme customization is something you can hardly avoid when using WordPress .
In many cases, the customizations you want are not directly supported by WordPress or themes by the interface.
What I mean is that you have to directly edit the code in the theme files. The danger here, is that the edits will be lost when you update the new version of the theme.
But updating the theme is a must for security reasons.
So is there a way that you can still keep the customization when updating the theme?
Creating a child theme in WordPress is your solution.
In this article, I will show you what child themes in WordPress are, and how to create them.
Contents
What is Child Theme?
The name child theme has also suggested to you the meaning and purpose of the child theme.
Child Theme is also theme but it inherits features and interface from a parent theme that you are using on your site.
The important points are:
Any changes you make in the child theme will not be lost when you update the parent theme.
In fact, WordPress will see the child theme first. If you modify the look or function in the child theme, the changes will be applied. Then WordPress will return to the parent theme to use the functions that are not overridden in the child theme.
How to create a manual child theme in WordPress
If you’re not familiar with coding, the thought of creating a child theme can be a bit overwhelming. But actually creating a child theme is not that difficult. If not, it’s relatively easy.
The steps are as follows:
Navigate to wp-content/themes folder (using FTP or File Manager in CPanel)
Create a folder here. You can name any. But the most standard naming method is to name it the same as the parent theme and add ‘-child’ at the end.
For example, my parent theme is beginner, I will name the folder beginner-child
Create file style.css
Inside the folder you just created, you will create a new file named “style.css”
Copy and paste the following code into the newly created file:
/* Theme Name: Beginner Child Theme Theme URI: http: //thuthuatwp.com Description: Day la child theme cua Beginner Author: Thinh Nguyen Author URI: https://thuthuatwp.com Template: beginner Version: 0.1 */
You can change the information to your suit. But pay attention to the stamp plate section , you must type the correct name of the parent theme. The style.css file is case sensitive, so you must type 100%.
Save the style.css file you just changed.
Create the file functions.php
For the child theme to work, you create the theme file functions.php. And add the following code to this file.
<?php add_action( 'wp_enqueue_scripts', 'my_enqueue_assets' );
function my_enqueue_assets()
{
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>
The above code helps to load all the CSS from the parent theme.
Now you can go to Appearcance -> Themes to activate the child theme. At this point, you have not edited anything in the child theme, so the interface and functionality have not changed.
Edit child theme
CSS editing
If you want to change the CSS just open the style.css file of the child theme and add the code in the comment section.
In the example below I change the font-size
Edit PHP files
If you want to edit any PHP file of the parent theme, just copy it to the child theme folder.
In essence, when WordPress searches for files, it checks the first subdirectory. If the file exists, it will use the file in the child theme, otherwise it will not download the file from the parent theme. Only the functions.php file is the exception. WordPress will load both the child theme’s file and the parent theme’s files.
A note when copying files from the parent theme to the child theme you must keep the file structure. For example, I want to change the scripts.php file of the parent theme. This file is located in a folder called ” in c “
So I have to create the same inc folder inside the child theme and copy the scripts.php file there. If not clear, see the image below:
Create child theme in WordPress using plugin
In addition to creating additional children manually as above, you can use the Child Theme Configurator plugin to create child themes. This method is suitable for those who are new to WordPress, or want to save time.
How to create a child theme as follows:
First you install and activate the plugin. Then you go to Tools -> Child Themes , click Analyze to let the plugin analyze the theme you want to create a child theme
After the analysis is complete, there will be a configuration section to create a child theme. You can take a look, but generally don’t have to edit anything further. Finally, click ‘ Create New Child Theme’ to create a child theme
After creating the child theme, go to Appearance -> Themes to activate the child theme.
If you need to customize your CSS you can go to Appearance -> Editor . Or FTP to the host and edit it directly there.
Epilogue
Child theme is the best way to help you keep customizing any theme when need to update new version of theme. Creating a child theme in WordPress is also very simple. You can do it manually or through a plugin as a guide.
If you have any problems, leave a comment below.








