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
- Open
wp-content/themeson your server. - Find the directory for the theme you want to extend, such as
twentytwentyfour. - Record that directory name exactly. The value is case-sensitive and is the value required in the child theme’s
Templateheader; 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.
#1 Best Overall
- Used Book in Good Condition
/*
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
- In the WordPress dashboard, open Appearance → Themes.
- Locate Grand Sunrise (or your chosen name).
- 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.
Rank #2
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.
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.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallUse 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.
Rank #4
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.
Best Value
- 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.
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.
Troubleshoot common problems
The child theme does not appear or cannot be activated
- Confirm that
style.cssis in the child directory’s root. - Check that the header uses valid fields, especially
Theme NameandTemplate. - Make sure
Templateexactly 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.jsonand 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.phpcontents. - 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
Child theme creation checklist
- Parent directory slug identified from
wp-content/themes. - Child directory created alongside the parent.
- Root
style.cssincludes a matching, case-sensitiveTemplatevalue. - Child theme activated from Appearance → Themes.
- Parent stylesheet behavior checked before adding enqueues.
- Child
functions.phpcontains 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.

