Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A WordPress child theme is a separate theme that inherits a parent theme’s templates, styles and functionality while keeping your modifications in their own directory. Create a child folder under wp-content/themes, add a root style.css whose Template header exactly matches the parent folder name, activate the child, and then add only the files or code you need to change. Parent-theme updates can then be installed without overwriting those child files.

What a child theme does

Child themes are extensions of parent themes. The child inherits the parent’s files until a same-named child file takes precedence. This lets you customize a site without editing the parent theme directly.

A child theme does not create an independent copy of the parent. It depends on that parent remaining installed, and its customizations apply only while the child theme is active.

Before you start: identify the parent theme

  1. Open wp-content/themes on your server.
  2. Find the directory for the theme you want to extend, such as twentytwentyfour.
  3. Record that directory name exactly. The value is case-sensitive and is the value required in the child theme’s Template header; it is not necessarily the theme’s display name.

Create the child-theme folder and required stylesheet

Create a new directory beside the parent. Use a simple, kebab-case slug, for example grand-sunrise. Add a file named style.css at the child theme’s root:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
/*
Theme Name: Grand Sunrise
Template: twentytwentyfour
*/

Replace twentytwentyfour with the parent directory name you found. The Theme Name is the human-readable label shown in WordPress; Template establishes the parent relationship and must match exactly.

Add your CSS

Place child-specific rules below the header. Whether those rules are loaded automatically depends on the parent theme, so verify the parent’s stylesheet setup before assuming that an empty or populated style.css will appear on the front end.

Activate the child theme

  1. In the WordPress dashboard, open Appearance → Themes.
  2. Locate Grand Sunrise (or your chosen name).
  3. Select Activate.

The site should initially look like the parent because the child inherits its files. Your child files become effective as you add them.

Load parent and child styles correctly

Stylesheet behavior differs between themes. Inspect the parent theme’s code or generated page source to determine whether it loads the parent stylesheet, the active theme stylesheet, both, or styles through another system. Use wp_enqueue_style() on wp_enqueue_scripts rather than hard-coding a <link> tag.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When the parent already handles the child stylesheet

If the parent enqueues the active theme’s stylesheet (or otherwise documents child-theme support), add your CSS to the child style.css and avoid adding a second enqueue that would duplicate it.

Enqueue the child stylesheet when it is not loaded

<?php
add_action( 'wp_enqueue_scripts', 'grand_sunrise_enqueue_styles' );
function grand_sunrise_enqueue_styles() {
    wp_enqueue_style( 'grand-sunrise-style', get_stylesheet_uri() );
}

Put this code in the child theme’s functions.php. The function name and handle should be unique to your theme.

When the parent loads only its own stylesheet

If the parent loads only its own style.css, enqueue that file explicitly and make the child handle depend on it when appropriate:

<?php
add_action( 'wp_enqueue_scripts', 'grand_sunrise_enqueue_styles' );
function grand_sunrise_enqueue_styles() {
    wp_enqueue_style(
        'grand-sunrise-parent',
        get_parent_theme_file_uri( 'style.css' )
    );

    wp_enqueue_style(
        'grand-sunrise-style',
        get_stylesheet_uri(),
        array( 'grand-sunrise-parent' )
    );
}

Do not use this blindly: first check whether the parent already enqueues either file, because duplicate registrations can create ordering and maintenance problems.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use functions.php safely

A child theme’s functions.php is loaded immediately before the parent’s file. It augments the parent; it does not replace it. Create a new child functions.php for design-specific hooks, filters and setup code, but do not copy the parent file into it.

Both files execute, so copied functions or identical function names can trigger “cannot redeclare” fatal errors. Give your functions unique names, and add only the changes you need.

Theme code or plugin code?

Keep presentation and theme-specific behavior in the child theme. Put site-wide features—such as custom post types, business rules or integrations that must survive a future theme change—in a plugin. Child-theme code is tied to that theme relationship and stops running when another theme is activated.

Override templates, parts and patterns

Classic and hybrid themes

To change a parent template, copy it into the child theme using the same relative path and filename, then edit the child copy. WordPress uses the child version for that template while continuing to obtain other files from the parent.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Teacher Record Book
  • Keep track of everything from attendance to test scores
  • Spiral bound
  • Measures 8-1/2" x 11"

Block themes

Block themes commonly express design through theme.json, templates, template parts and patterns rather than a traditional PHP-template workflow. A child can override same-named files and parts. For a pattern override, the child pattern must also use the same registered Slug; changing only the filename is not enough.

Because block themes may handle much of their styling through theme.json, missing CSS is not necessarily an enqueue problem. Check the parent’s block-theme configuration and the child’s theme.json before adding PHP enqueue code.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Optional: generate starter files with WP-CLI

If WP-CLI is installed and you have access to the WordPress installation, run:

wp scaffold child-theme grand-sunrise --parent_theme=twentytwentyfour

Replace both slugs with your child directory name and the exact parent directory name. The command generates starter style.css and functions.php files, after which you still need to review stylesheet loading and add your customizations.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot common problems

The child theme does not appear or cannot be activated

  • Confirm that style.css is in the child directory’s root.
  • Check that the header uses valid fields, especially Theme Name and Template.
  • Make sure Template exactly matches the parent folder slug, including capitalization.
  • Ensure the parent theme is installed.

Styles are missing

  • Inspect the parent’s enqueue behavior before adding more code.
  • Check the browser’s page source or network panel for the parent and child CSS URLs.
  • For block themes, inspect theme.json and block styles as well as PHP enqueues.
  • Verify that your CSS selectors are specific enough and that the stylesheet loads after the rules you intend to override.

A PHP fatal error appears after adding functions.php

  • Remove any copied parent functions.php contents.
  • Search for duplicate function names and rename child functions with a unique prefix.
  • Check syntax and temporarily disable the newest hook to isolate the failing code.

Changes vanish after switching themes

That is expected for theme-bound code. Move functionality that must remain active across theme changes into a plugin, then leave only presentation-specific code in the child theme.

Quick Recap

SaleBestseller No. 4
Bestseller No. 5
Teacher Record Book
Teacher Record Book
Keep track of everything from attendance to test scores; Spiral bound; Measures 8-1/2" x 11"
$4.89

Child theme creation checklist

  • Parent directory slug identified from wp-content/themes.
  • Child directory created alongside the parent.
  • Root style.css includes a matching, case-sensitive Template value.
  • Child theme activated from Appearance → Themes.
  • Parent stylesheet behavior checked before adding enqueues.
  • Child functions.php contains additions, not a copied parent file.
  • Template, part or pattern overrides use the parent’s expected path and, for patterns, the same registered slug.
  • Theme-independent functionality moved to a plugin.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.