How to Create a Child Theme in WordPress

September 11, 2025
How to Customize the WordPress Excerpt (Length and “Read More” Link)

A child theme in WordPress is a theme that inherits the functionality and styling of another theme, called the parent theme. Creating a child theme lets you safely customize your site without losing changes when the parent theme updates. Here’s how to create one step by step.

Step 1: Create a Child Theme Folder

  1. Use FTP or File Manager in your hosting control panel.
  2. Navigate to wp-content/themes/.
  3. Create a new folder for your child theme. Example: mytheme-child.

Step 2: Create a style.css File

Inside the child theme folder, create a file named style.css with the following content:

/*
 Theme Name:   MyTheme Child
 Theme URI:    https://example.com/mytheme-child
 Description:  Child theme for MyTheme
 Author:       Your Name
 Author URI:   https://example.com
 Template:     mytheme
 Version:      1.0.0
*/

/* Custom CSS starts here */
body {
    background-color: #f9f9f9;
}

Important: The Template value must match the folder name of your parent theme (e.g., mytheme).

Step 3: Create a functions.php File

In the same folder, create a functions.php file to enqueue the parent and child styles:

<?php
function mytheme_child_enqueue_styles() {
    // Enqueue parent theme stylesheet
    wp_enqueue_style(
        'parent-style',
        get_template_directory_uri() . '/style.css'
    );

    // Enqueue child theme stylesheet
    wp_enqueue_style(
        'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array('parent-style')
    );
}
add_action('wp_enqueue_scripts', 'mytheme_child_enqueue_styles');

Step 4: Activate the Child Theme

  1. Log in to your WordPress dashboard.
  2. Go to Appearance → Themes.
  3. You should see your new child theme listed.
  4. Click Activate.

Step 5: Customize Safely

  • Add CSS rules in style.css.
  • Copy template files (e.g., header.php) from the parent theme into the child theme folder and edit them as needed.
  • Write PHP functions in functions.php to extend or modify features.

Best Practices

  • Only copy template files you plan to change—WordPress will use the parent theme’s files for everything else.
  • Keep the child theme lightweight to ensure easy updates to the parent theme.
  • Always test on a staging site before making major edits.

Summary

  1. Create a new folder in wp-content/themes/ for your child theme.
  2. Add a style.css file with the correct header and custom styles.
  3. Create a functions.php to enqueue parent and child stylesheets.
  4. Activate the child theme from the dashboard.
  5. Customize safely without losing changes during theme updates.

With a child theme, you can confidently personalize your WordPress site while keeping the parent theme fully updatable.

Avatar

Written by

satoshi

I’ve been building and customizing WordPress themes for over 10 years. In my free time, you’ll probably find me enjoying a good football match.