How to Create a Child Theme in WordPress

WordPress is a powerful platform that offers a lot of flexibility in terms of customizing your website’s appearance and functionality. However, making changes to your website’s theme can be risky, as these changes may be lost when the theme is updated. To avoid this issue, WordPress offers a solution called child themes.

What is A Parent Theme?

In WordPress, a parent theme is a complete and independent theme that is used as the foundation or basis for creating a child theme. The parent theme contains all the necessary code and functionality to define the overall appearance, layout, and behaviour of a WordPress website.

A parent theme typically includes a set of templates, styles, scripts, and other files that define the design and functionality of the website. This includes elements like the header, footer, navigation menus, post and page templates, widgets, and more.

When a user creates a child theme, they start with a parent theme and can modify or extend its features and design elements to create a customized version of the parent theme. The child theme can override the parent theme’s templates, styles, and scripts and add new functionality or features.

Using a parent theme as a foundation for a child theme has several benefits. First, it provides a starting point for WordPress developers who want to create a custom WordPress theme without having to build everything from scratch. Additionally, it ensures that the child theme remains compatible with WordPress updates, as it inherits updates from the parent theme.

Overall, using a parent theme and child theme architecture is a powerful tool for WordPress developers, allowing them to quickly build custom themes and maintain their compatibility with future WordPress updates.

You May Like: What is Serverless Architecture?

What is a Child Theme?

In WordPress, a child theme is a theme that inherits the functionality and styling of another theme, called the parent theme. The child theme can be used to modify or add to the parent theme’s features without directly modifying the original theme’s files. Instead, the child theme’s files override or supplement the parent theme’s files.

Child themes are often used to make customizations to an existing theme while keeping the original theme’s updates and bug fixes intact. By creating a child theme, users can modify a theme’s templates, styles, and functionality without losing those modifications when the theme is updated.

You May Like: What is Full Site Editing

Benefits of using a Child Theme

Using a child theme in WordPress offers several benefits, including:

Safe and Stable Updates: One of the main benefits of using a child theme is that it allows you to change the design and functionality of a parent theme without modifying the parent theme’s files directly. This means that your customizations will not be lost or overwritten when the parent theme is updated. Instead, your changes will remain intact in the child theme, making updates safe and stable.

Customization Flexibility: With a child theme, you have complete control over the design and functionality of your website. You can make any desired changes, such as adding new features, modifying existing features, or changing the design of your website without affecting the original theme. This allows you to create a unique website that meets your specific needs.

Improved Site Performance: When you create a child theme, you only need to include the files and functionality that you need. This can help to reduce the size of your website’s files and improve the site’s performance by decreasing the load time.

Easier to Maintain: Using a child theme can make it easier to maintain your website because it allows you to keep your modifications separate from the original theme. This can make it easier to troubleshoot issues and track changes.

Code Reusability: If you manage multiple websites, using a child theme can save you time and effort. You can reuse the child theme on other websites and simply customize it as needed. This can help you to create consistent branding and functionality across multiple websites.

You May Like: Signs that you need a Developer for your WordPress Website

Prerequisites for creating a Child Theme

To create a child theme in WordPress, you will need the following prerequisites:

  • A working WordPress installation: You must have WordPress installed and running on your web server. If you haven’t already done so, you can download WordPress from the official website and install it on your server.
  • A parent theme: To create a child theme, you will need a parent theme that you want to modify. The parent theme should be installed and activated on your WordPress site. You can choose any WordPress theme to use as a parent theme, but it’s best to choose a regularly updated and maintained theme.
  • Text editor: You will need a text editor to create and modify the files in your child theme. Any text editor can be used. But many developers prefer a code editor like Visual Studio Code, Sublime Text, or Atom.
  • FTP or SFTP client: You will need to access the WordPress installation files on your server to create and upload the child theme files. You can use an FTP or SFTP client, such as FileZilla, to connect to your web server and upload files.
  • Basic knowledge of HTML, CSS, and PHP: To create a child theme, you should have a basic understanding of HTML, CSS, and PHP. This will enable you to modify the parent theme’s files and create custom templates and styles for your child theme.

Creating Your First Child Theme

You can manually create a child theme by creating the required folder and files. Alternatively, you can create a child theme using a plugin.

Method 1: Using Code to Create a Child Theme

Method 2: Using a Plugin to Generate a Child Theme

First Method: Using Code to Create a Child Theme

Here’s how you can create a child theme in WordPress:

1. Create a new folder

  • To create a new folder for a child theme in WordPress, follow these steps:
  • Connect to your WordPress site via FTP or SFTP.
  • Navigate to the ‘wp-content/themes’ directory.
  • Create a new folder with the name of your child theme. For example, if you want to create a child theme for the Twenty Twenty-One theme, you could name the folder ‘twentytwentyone-child’.

You May Like: What is WordPress Multisite

2. Create a style.css file.

Within your new child theme folder, create a new file called style.css. This file is required and should contain the following code:

Theme Name: Twenty Twenty-One Child
Theme URI:
Description: Twenty Twenty-One Child Theme
Author: Your Name
Author URI:
Template: twentytwentyone
Version:  1.0.0
License: GNU General Public License v2 or later
License URI:
Tags:light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-twenty-one-child

Replace the information above with your own information. Make sure to use the name of your child theme and the name of the parent theme in the Template field.

These lines of code are the header information for a child theme in WordPress, which is included in the “style.css” file.

Let’s go over what each line means:
  • Theme Name: This is the name of your child theme, which will be displayed in the WordPress dashboard and on your website.
  • Theme URI: This is the URL of your child theme’s website, which can be helpful for providing more information about your theme.
  • Description: This is a brief description of your child theme that helps users understand what it is and what it does.
  • Author: This is the name of the person or company that created the child theme.
  • Author URI: This is the URL of the author’s website or company.
  • Template: This is the name of the parent theme that your child theme is based on. In this example, the child theme is based on the Twenty Twenty-One parent theme.
  • Version: This is the version number of your child theme.
  • License: This is the type of license under which your child theme is released. In this case, it’s the GNU General Public License v2 or later.
  • License URI: This is the URL of the license that your child theme is released under.
  • Tags: These are descriptive tags that help users find your child theme based on its features, such as its layout, responsiveness, and accessibility.
  • Text Domain: This is a unique identifier for your child theme that helps WordPress locate and load the correct translation files.

The header information for a child theme is essential because it helps identify your theme, its features, and its licensing information. It also ensures that your child theme is appropriately recognized and displayed in the WordPress dashboard.

You May Like: Reasons to avoid Nulled Themes and Plugins

3. Create a functions.php file.

Create a new file called functions.php in your child theme folder. This file will contain any custom functions or code that you want to add to your child theme. At a minimum, this file should include the following code:

// Enqueue parent theme stylesheet
add_action( ‘wp_enqueue_scripts’, ‘enqueue_parent_theme_style’ );
function enqueue_parent_theme_style() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );

This code will enqueue the parent theme’s stylesheet so that it is loaded before your child theme’s stylesheet, allowing you to override any styles you want to change.

4. Activate your child theme.

To activate your child theme in WordPress, follow these steps:

  • Go to your WordPress dashboard.
  • Go to the ‘Appearance’ section and click on ‘Themes’.
  • You should see your child theme listed among the available themes. Click on the ‘Activate’ button to activate your child theme.
  • Once you activate your child theme, it will inherit all the functionality and styling of its parent theme. You can then modify the child theme’s files to add customizations without affecting the parent theme.

5. Customize your child theme.

Here are some ways to customize your child theme.

  • Modify the style.css file: The style.css file contains information about your child theme, such as the theme name, author, version, and a list of styles that are applied to your child theme. You can modify the styles in this file to change the appearance of your child theme.
  • Create custom templates: To create custom templates for your child theme, you can duplicate the parent theme’s template files and modify them in the child theme folder. For example, if you want to modify your theme’s header, you can duplicate the header.php file from the parent theme and modify it in the child theme folder. WordPress will automatically use the child theme’s version of the file instead of the parent theme’s version.
  • Modify the functions.php file: The functions.php file contains code that runs when WordPress loads your theme. You can add custom functions to this file to modify the functionality of your child theme. For example, you can use this file to register custom post types, custom taxonomies, or custom widgets.
  • Add custom CSS or JavaScript: You can add custom CSS or JavaScript to your child theme by creating separate files for them and enqueuing them in the functions.php file. This allows you to add custom styles or scripts to your child theme without modifying the parent theme’s files.
  • Use hooks and filters: WordPress provides several hooks and filters that allow you to modify the behaviour of WordPress or plugins without modifying their code directly. You can use these hooks and filters to modify the functionality of your child theme without modifying the parent theme’s files.
That’s it! You now have a child theme that you can use to customize your WordPress website.

Remember to test your customizations thoroughly and ensure they work as expected. Also, keep in mind that your customizations may be affected by updates to the parent theme or WordPress itself. So it’s a good idea to keep a record of your customizations and update them as needed.

You May Like: What is Gatsby Framework

Second Method: Using a Plugin to Create a Child Theme

There are several plugins available that can help you generate a child theme quickly and easily. One popular plugin for this purpose is the Child Theme Configurator. Here’s how you can use this plugin to generate a child theme:

  1. Install and activate the Child Theme Configurator plugin: Install and activate the plugin from the WordPress plugin repository.
  2. Launch the Child Theme Configurator: Go to the Appearance menu in your WordPress dashboard, and click on Child Theme Configurator.
  3. Choose the parent theme: Select the parent theme you want to create a child theme for.
  4. Configure the child theme: Choose a name for your child theme, and customize any other settings you want to change, such as the colour scheme or custom CSS.
  5. Save the child theme: Once you have configured the child theme settings, click the “Create New Child Theme” button to create the child theme.
  6. Activate the child theme: Once the child theme has been created, activate it by going to the Appearance menu and selecting the child theme from the list of available themes.
  7. Customize the child theme as needed: Now that you have a child theme set up, you can customize it by modifying the CSS or creating custom templates, as described in the previous sections.

Using a plugin to generate a child theme can be a quick and easy way to get started with customizing your site. However, it’s still important to be familiar with the basics of child theme creation and WordPress development in general so that you can make more advanced modifications if needed.

You May Like: How to Optimize Core Web Vitals

Additional Resources that might be helpful in Creating Child Theme

There are several resources available online for creating a child theme in WordPress. Here are some of the most helpful ones: has an official guide on how to create a child theme. It provides a step-by-step process, including the code snippets required for creating a child theme.

GitHub – If you are familiar with coding, you can check out the WordPress GitHub repository for creating child themes. It has several code examples and resources for creating child themes.

WordPress 5 Complete – This book by Karol Krol covers the basics of WordPress theme development. It also delves into advanced topics such as custom post types, theme customization, and plugin development.

WordPress Theme Development with Underscores – This course is offered by Envato Tuts+. It teaches how to develop a custom WordPress theme using the Underscores starter theme. It covers the basics of WordPress theme development, as well as best practices for coding and performance optimization.

You May Like: What is Plugin Conflict and How to Resolve it


Creating a child theme is a simple and effective way to customize your WordPress site without affecting the original theme files. By following the basic steps outlined above, you can create a child theme that meets your specific design and functionality requirements. Whether you’re a beginner or an experienced developer, creating a child theme can help you achieve a unique and personalized website that stands out from the crowd.

Leave a Reply

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