Step-by-Step Create WordPress Child Theme

Jul 19, 2023ยท

6 min read

Step-by-Step Create WordPress Child Theme
Play this article


WordPress child theme offers a secure approach to customizing your WordPress theme's code. When considering direct edits to the theme's CSS, HTML, or PHP, opting for a WordPress child theme is crucial to avoid losing your modifications during future theme updates.

After grasping the fundamentals of WordPress, the next step for many is to explore customization options for their WordPress site. Child themes serve as an excellent starting point for individuals seeking to customize WordPress themes.

This article will demonstrate the process of creating a child theme in WordPress.

What is the Purpose of Using a Child Theme?

A child theme in WordPress is designed to inherit the functionality, features, and design elements of its parent theme. It allows you to customize the appearance and behaviour of your website without directly modifying the parent theme's files.

The primary advantages of using a child theme are time and effort savings. Since the parent theme already includes a considerable amount of formatting and functionality, you don't have to start from scratch when making customizations.

Additionally, child themes offer a safety net when updating your WordPress themes. As you modify the child theme rather than the parent, your customizations remain intact even after updating the parent theme.

Furthermore, once you are satisfied with the customization of your child theme, you have the option to apply it to another WordPress site, making it a convenient and portable solution for consistent design and functionality across multiple websites.

Preparations Before Creating a Child Theme

Before embarking on the process of creating a child theme, there are several important considerations to keep in mind:

  1. Familiarity with Code: As child theme development involves working with code, it's essential to have a basic understanding of HTML and CSS. This knowledge will enable you to comprehend the necessary code modifications to achieve your customization goals. Some familiarity with PHP is also beneficial, as you may need to copy and paste code snippets from various sources.

  2. Local Development Environment: It is recommended to practice creating your child theme on a local development environment. You can either migrate a live WordPress site to a local server for testing purposes or utilize dummy content for theme development. This way, you can experiment and make changes without affecting your live website.

  3. Parent Theme Selection: Carefully choose a parent theme that closely aligns with your desired appearance and features for the final website. Selecting a parent theme that already encompasses most of what you need will reduce the number of modifications required in the child theme.

By taking these factors into account, you'll be better prepared to create an effective and customized child theme for your WordPress site.

Method 1: Creating a Child Theme Using Code

To begin creating your child theme, follow these steps:

  1. Access WordPress Installation Folder: Use FTP or your hosting file manager to access your WordPress installation folder. Navigate to the "/wp-content/themes/" directory.

  2. Create a New Folder: Inside the "/wp-content/themes/" directory, create a new folder for your child theme. You can choose any name for the folder. For this example, we will name it "mychildtheme" to represent the child theme.

Now, you have a new folder named "mychildtheme" within the "themes" directory. This folder will serve as the foundation for your WordPress child theme.

Let's go through an example of creating a child theme based on a fictional parent theme called "MyParentTheme." In this example, we'll assume you have a basic understanding of HTML, CSS, and PHP.

  1. Create a New Folder: First, create a new folder on your computer and name it something like "MyChildTheme."

  2. Create a Stylesheet: Within the "MyChildTheme" folder, create a new file named "style.css." This file will contain the styles specific to your child theme.

* Theme Name:   My Child Theme
* Theme URI:
* Description:  A Twenty Twenty-One child theme 
* Author:       Mansi Jani
* Author URI:
* Template:     twentytwentyone
* Version:      1.0.0
* Text Domain:  twentytwentyonechild

In the above code, we specify the theme name for the child theme and indicate the parent theme it is based on ("MyParentTheme").

  1. Enqueue Stylesheet: To load the child theme's styles, you need to enqueue the stylesheet in the "functions.php" file of your child theme.

Create a new file named "functions.php" in the "MyChildTheme" folder:

add_action( 'wp_enqueue_scripts', 'my_child_theme_enqueue_styles' );
function my_child_theme_enqueue_styles() {
    $parent_style = 'parent-style'; // This should match the parent theme's registered stylesheet handle.
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ), wp_get_theme()->get('Version') );
  1. Customize Your Child Theme: Now you can start making customizations to your child theme's "style.css" file to achieve the desired appearance. You can override any styles from the parent theme by adding your modifications here.
/* Custom Styles for My Child Theme */
body {
    font-family: Arial, sans-serif;

/* Additional styles specific to the child theme */
  1. Testing the Child Theme: If you have a local development environment set up, you can upload the "MyChildTheme" folder to the "wp-content/themes/" directory and activate the child theme through the WordPress admin dashboard.

  2. Making Changes to PHP Files (Optional): If you want to make changes to the functionality of the parent theme, you can do so by copying specific PHP files from the parent theme into the "MyChildTheme" folder and modifying them accordingly. However, be cautious when modifying PHP files, as incorrect changes can break the theme.

Remember, always back up your files before making any modifications, and use a local development environment or a staging site for testing to avoid affecting your live website.

Method 2: Creating a Child Theme Using a Plugin

Child Theme Configurator is a user-friendly WordPress plugin that enables you to swiftly create and customize child themes without the need for coding.

To get started, follow these steps:

  1. Install and Activate the Plugin: Go to your WordPress admin dashboard, then navigate to "Plugins" and click on "Add New." Search for "Child Theme Configurator," install the plugin, and activate it.

  2. Access Child Theme Configurator: Once the plugin is activated, locate the "Child Themes" option under "Tools" in your WordPress dashboard. Click on it to access the Child Theme Configurator.

  3. Select Parent Theme: Inside the Child Theme Configurator, head to the "Parent/Child" tab. Here, you'll find a drop-down menu prompting you to choose a parent theme. From the options available, select the "Twenty Twenty-One" theme (this is just an example; you can choose any parent theme you wish to customize).

By following these steps, you'll be ready to begin creating and customizing your child theme using the Child Theme Configurator plugin. It allows you to make changes to your WordPress site's appearance and functionality without the necessity of writing code, making the process simpler and more accessible for users with little to no coding experience.

Frequently Asked Questions

Q: How can I create a child theme in WordPress?

There are two methods to create a child theme: manual creation or using a plugin such as Child Theme Wizard. While the manual approach requires technical knowledge and is more time-consuming compared to the plugin.

Q: What benefits does a WordPress child theme offer?

The primary advantage of utilizing a child theme is that it enables you to make modifications to your website without altering the code of the parent theme. This is crucial because any customizations made to the parent theme would be lost when the theme is updated.

Q: What are the steps to manually create a child theme?

Follow these five steps to manually create a child theme:

  1. Create a dedicated folder for the child theme.

  2. Generate a stylesheet specifically for the child theme.

  3. Enqueue both the parent and child themes' stylesheets.

  4. Edit the style.css file of the child theme.

  5. Customize a template file, such as single.php, in the child theme as needed.

Did you find this article valuable?

Support Mansi Jani by becoming a sponsor. Any amount is appreciated!