How to Use and Set Up a WordPress Child Theme

Table of Contents


A WordPress child theme is a theme that inherits the functionality and styling of its parent theme. Using a child theme allows you to modify the design and code of the parent theme without directly altering its files, making it easier to update the parent theme without losing your customizations. In this article, we will guide you through the process of setting up and using a WordPress child theme.

Step 1: Choose a Parent Theme

Before you create a child theme, you need to choose a parent theme. This can be a free or premium theme available in the WordPress repository, or one you’ve purchased from a third-party developer. It’s crucial to select a well-coded, responsive, and regularly updated parent theme, as it will form the foundation of your website’s design and functionality.

Step 2: Create a Child Theme Directory

To create a child theme, first, navigate to your WordPress installation’s “wp-content/themes” directory using an FTP client or your web host’s file manager. Create a new folder inside the “themes” directory, and give it a descriptive name. For example, if your parent theme’s name is “twentytwentyone,” you could name your child theme “twentytwentyone-child.”

Step 3: Create a Style Sheet (style.css)

Inside the child theme’s folder, create a new file named “style.css.” Open the file in a text editor and add 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:
Text Domain: twentytwentyone-child

Make sure to replace the relevant information, such as the theme name, theme URI, description, author, author URI, and most importantly, the “Template” value. The “Template” value should match the parent theme’s directory name (in this example, “twentytwentyone”).

Step 4: Create a Functions File (functions.php)

Next, create a new file in your child theme’s directory called “functions.php.” Open the file in a text editor and add the following code to enqueue the parent theme’s stylesheet:

add_action( ‘wp_enqueue_scripts’, ‘my_child_theme_enqueue_styles’ );
function my_child_theme_enqueue_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );

This code tells WordPress to load the parent theme’s “style.css” file before the child theme’s stylesheet.

Step 5: Activate Your Child Theme

Log in to your WordPress admin dashboard, and navigate to “Appearance” > “Themes.” You should see your newly created child theme listed alongside the other installed themes. Click on the “Activate” button to activate your child theme.

Step 6: Customize Your Child Theme

Now that your child theme is active, you can begin customizing it. Any modifications you make to the child theme’s files will override the corresponding parent theme files. For example, if you want to modify the header, copy the “header.php” file from the parent theme’s directory to the child theme’s directory and edit it as needed. Your changes will be preserved when the parent theme is updated.


Using a WordPress child theme is an efficient way to safely customize your website’s design and functionality while preserving the ability to update the parent theme. By following the steps outlined in this article, you can create a child theme, activate it, and begin making customizations to your site without risking the loss of your changes during future updates.

One thought on “How to Use and Set Up a WordPress Child Theme

  1. Some additional tips for working with child themes:

    Use the WordPress Customizer: Navigate to “Appearance” > “Customize” in your WordPress admin dashboard to make design and layout changes using the built-in customizer. This tool allows you to preview your changes before publishing them.

    Add custom CSS: If you need to add custom CSS styles, you can either do so in the “style.css” file of your child theme or use the “Additional CSS” section in the WordPress Customizer.

    Overriding parent theme functions: To override a parent theme function, copy the function to your child theme’s “functions.php” file and modify it as needed. Make sure to change the function name to avoid conflicts.

    Test your changes: Before updating your parent theme or making significant changes to your child theme, test your site on a staging environment to ensure everything is working as expected.

    Keep track of your customizations: Document your customizations, including any code changes, in a separate file or a code repository. This practice will make it easier to troubleshoot issues, revert changes, or migrate your customizations to another theme in the future.

    By following these best practices and understanding the importance of child themes in WordPress, you can efficiently customize your website while maintaining its stability and update compatibility. Happy customizing!

Leave a Reply

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