Posts

WordPress – Creating A Child Theme

When you want to change your WordPress theme but don’t want your changes to be lost after the theme update, you should create a child theme. Creating a child theme in WordPress is quite simple. In this article, I will explain how you can create a child theme. You can easily create a child theme by following the steps below. Let’s start!

1. Creating a WordPress child theme’s folder

You need to create the child theme’s folder under the “wp-content/themes” directory. The name of the folder of the child theme should be “theme name-child”. In short, you should create the folder name by adding “child” to the end of the theme name.

2. Creating a stylesheet for child theme

You must create a style.css file under this folder. At the beginning of this file, you need to add code that defines this child theme and which theme is its parent theme. I am attaching the sample code below.

/*
Theme Name: Theme Name Child
Theme URI: http://example.com/theme-name-child/
Description: Theme Name Child Theme
Author: Example Author
Author URI: http://example.com
Template: themename
Version: 1.0.0
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: themenamechild
*/

* Description Of The Lines

The codes below are required;

* Theme Name: You must have a unique theme name, I recommend adding “child” at the end of the name. Defines the name of your theme.
* Template: You have to write the name of the parent theme. This defines which theme is the parent.

The rest are optional and you don’t have to write.

* Theme URI: This is for the theme’s website or the website with the theme’s working demo. This website address must be in the same domain as the author’s website.
* Description: This is the field to contain the description of your child theme.
* Author: You can write your own name here.
* Author URI: You can write your own website address here.
* Version: You can write the version code of your child theme here.
* License: Indicates which license your child theme uses. You can copy the license from the “style.css” file of your parent theme here.
* Tags: You can write tags that describe your child theme.
* Text Domain: This is used for localization and translation within WordPress. You can use the name of your parent theme as a slug and add “child” to the end. Example: “themenamechild”.

Up to this part is enough for you to create a child theme. In the next step, I will explain how to install and activate the theme. Then I will tell you what else you can do.

You can find more resources on WordPress’s website.

3. Uploading The Theme

If you have not created the theme-style file on the server, you can zip the folder and upload your theme from the upload theme section.