How to Create a Child Theme in WordPress

You've customised your WordPress theme — tweaked the typography, adjusted the layout, added a custom function or two. Then you update the theme and everything you changed is gone. Overwritten by the update.

This is one of the most common and avoidable WordPress frustrations — and the solution is a child theme.

A child theme is a theme that inherits all the look and functionality of its parent (your main theme) but keeps your customisations in a separate, protected location. When the parent theme updates, the child theme remains untouched. Your changes survive.

This guide walks through exactly what a child theme is, when you need one, and how to create one — both manually and with a plugin.

What Is a WordPress Child Theme?

A child theme is a WordPress theme that is built on top of another theme (the parent theme). It:

  • Inherits all the styles, templates, and functionality of the parent theme
  • Overrides only the specific files, styles, or functions you want to customise
  • Survives parent theme updates with your customisations intact

The parent theme provides the foundation. The child theme provides your customisations. When WordPress loads a child theme, it first checks the child theme for a requested file — if it finds it, it uses the child's version; if not, it falls back to the parent theme's version.

When Do You Need a Child Theme?

  • Whenever you customise a theme's PHP files. If you add functions to functions.php, modify a template file (header.php, footer.php, single.php), or change any theme PHP file — you need a child theme to preserve those changes through updates.
  • When adding custom CSS that belongs to the theme. WordPress's built-in Customizer → Additional CSS field is safe from updates and is fine for minor tweaks. But for significant CSS work, a child theme's style.css provides better organisation.
  • When modifying template files. Changing how posts, pages, archives, or custom post types are structured requires modifying template files — this always needs a child theme.

You do NOT need a child theme for:

  • Changes made through the Customizer (colours, fonts, header settings)
  • CSS added via Customizer → Additional CSS
  • Changes made through theme settings panels (most modern themes)
  • Changes made via page builders (Elementor, Kadence Blocks, etc.)

If all your customisations go through the Customizer or your theme's settings panel, you may not need a child theme.

Method 1: Create a Child Theme Manually

01
Create the Child Theme Folder

Connect to your server via FTP (FileZilla) or open your hosting file manager.

Navigate to:

/wp-content/themes/

Create a new folder with a clear name identifying it as the child theme:

  • Parent theme: astra → Child: astra-child
  • Parent theme: kadence → Child: kadence-child
  • Parent theme: twentytwentyfour → Child: twentytwentyfour-child
02
Create the style.css File

Inside your new child theme folder, create a file named style.css. Add the following content, replacing the values with your actual theme information:

CSS
/*
 Theme Name:   Astra Child
 Theme URI:    https://www.acemindtech.com
 Description:  Child theme for the Astra theme
 Author:       AceMindTech
 Author URI:   https://www.acemindtech.com
 Template:     astra
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Text Domain:  astra-child
*/
The most important line is Template: — this must exactly match the folder name of the parent theme (not the theme's display name, but its actual folder name). If the parent theme's folder is astra, Template must be astra. If the parent is kadence, Template is kadence.

Any custom CSS you add below the header comment block will be applied to your site on top of the parent theme's styles.

03
Create the functions.php File

Without a functions.php file in the child theme, the parent theme's styles won't load automatically. Create a file named functions.php in your child theme folder with this content:

PHP
<?php
/**
 * Enqueue parent and child theme stylesheets
 */
function acemindtech_child_enqueue_styles() {
    $parent_style = 'astra-style'; // Replace with the parent theme's style handle

    wp_enqueue_style(
        $parent_style,
        get_template_directory_uri() . '/style.css',
        array(),
        wp_get_theme( 'astra' )->get( 'Version' ) // Replace 'astra' with parent theme slug
    );

    wp_enqueue_style(
        'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get( 'Version' )
    );
}
add_action( 'wp_enqueue_scripts', 'acemindtech_child_enqueue_styles' );

Finding the parent theme's style handle:

The $parent_style variable must match the handle used by the parent theme to register its stylesheet. Find it by:

  1. View source of your site (Ctrl/Cmd+U)
  2. Search for the parent theme's style.css in the source
  3. It'll look like: <link rel='stylesheet' id='astra-style-css'
  4. The handle is everything before -css → astra-style

Common parent theme style handles:

Astra → astra-style
Kadence → kadence-style
GeneratePress → generate-style
OceanWP → oceanwp-style
Twenty Twenty-Four → twenty-twenty-four-style
04
Activate the Child Theme
  1. Log in to WordPress
  2. Go to Appearance → Themes
  3. You should see your new child theme listed
  4. Click Activate
Your site should look identical to before — but now customisations in the child theme are protected from parent theme updates.

Method 2: Create a Child Theme with a Plugin

Child Theme Configurator (Free Plugin)

If you'd rather not create files manually, the Child Theme Configurator plugin (free) handles the entire process through a GUI:

  1. Install and activate Child Theme Configurator
  2. Go to Tools → Child Themes
  3. Select the parent theme from the dropdown
  4. Configure options (theme name, author, directory)
  5. Click Create New Child Theme
  6. The plugin creates all required files and optionally activates the child theme

This is the simplest method for non-developers.

How to Add Customisations to Your Child Theme

Adding Custom CSS

Add custom CSS directly in your child theme's style.css file, after the header comment block:

CSS — style.css
/* Custom styles */

/* Change body font size */
body {
    font-size: 17px;
}

/* Make H2 headings a specific color */
h2 {
    color: #2c3e50;
}

/* Add padding to the main content area */
.site-content {
    padding: 40px 0;
}

These styles load after the parent theme's CSS and override it where they conflict.

Adding Custom Functions

Add custom PHP functions to your child theme's functions.php:

PHP — functions.php
// Remove the parent theme enqueue function above this line if present

/**
 * Example: Change excerpt length
 */
function acemindtech_custom_excerpt_length( $length ) {
    return 30;
}
add_filter( 'excerpt_length', 'acemindtech_custom_excerpt_length' );

/**
 * Example: Add custom image sizes
 */
function acemindtech_custom_image_sizes() {
    add_image_size( 'featured-blog', 800, 500, true );
}
add_action( 'after_setup_theme', 'acemindtech_custom_image_sizes' );

Overriding Parent Theme Templates

To modify how a specific template renders — for example, changing the layout of single blog posts — copy the template file from the parent theme to the same path in the child theme, then modify it.

Example: Override the single.php template

  1. In the parent theme folder, find single.php (or the file you want to modify)
  2. Copy it to the same location in your child theme folder:
    /wp-content/themes/your-child-theme/single.php
  3. Edit the copy in your child theme
  4. WordPress will now use the child theme's version instead of the parent's
When the parent theme updates single.php, your child theme's version remains unchanged. You'll need to manually review parent theme updates for changes to templates you've overridden — but your customisations are preserved.

Child Theme Best Practices

  • Keep the child theme focused. Only put in the child theme what you're actually customising. Don't duplicate parent theme files you haven't changed — it creates unnecessary maintenance overhead.
  • Comment your changes. Add comments explaining what each custom function or CSS block does and why it was added. Future-you (or another developer) will thank you.
  • Review parent theme changelogs after updates. When the parent theme updates, review the changelog. If a template you've overridden in the child theme was changed in the update, you may need to merge the parent's changes into your child's version.
  • Version your child theme. Increment the version number in style.css when you make changes. This is good practice for tracking evolution.
  • Back up the child theme. Your child theme is custom code — back it up separately from your WordPress backup. Store it in a Git repository or a cloud storage location.
Example of good commenting in CSS:
/* Increase line height for better readability on mobile - Added 2025-01-15 */

Frequently Asked Questions

Q: Do I need a child theme if I only use the Customizer?
A: No. Changes made through the Customizer (colours, fonts, logo, header settings) are stored in the database, not in theme files — they survive theme updates automatically. A child theme is only needed when you modify theme PHP files or add custom CSS outside the Customizer.
Q: Will my site look different after activating a child theme?
A: A properly configured child theme should look identical to the parent theme immediately after activation. The child theme inherits all parent styles. Any differences appear only after you add customisations to the child theme.
Q: Can I have a child theme of a child theme?
A: WordPress doesn't support grandchild themes. A child theme can only have one level of inheritance.
Q: What happens to my child theme if I change parent themes?
A: If you switch parent themes, your child theme will no longer work — it's specifically built for one parent. You'd need to either rebuild the child theme for the new parent or apply your customisations directly to the new theme's setup.
Q: Do page builder customisations need a child theme?
A: No. Elementor, Divi, and Kadence Blocks store their layouts in the WordPress database — not in theme files. These customisations survive theme updates regardless of whether you use a child theme.

Final Thoughts

Creating a child theme is a 10-minute task that protects potentially hours of customisation work from being wiped out by theme updates. If you're making any PHP or template customisations to your WordPress theme, a child theme is not optional — it's essential.

Create it now, before you make your first customisation. The manual method requires just two files and about 10 minutes. The plugin method requires even less.

Need help creating a child theme or structuring your WordPress customisations professionally? Our development team builds and maintains child themes for client sites regularly.

Contact us today and we'll sort it out.
Views: 149