Child Theme Generator

Build the style.css header, functions.php enqueue and theme.json a child theme needs, with the Template line and the stylesheet order already right.

Enable JavaScript to change the fields; the files below are for the defaults.

Shown in Appearance, Themes. Anything is allowed here; the folder name is separate.

The folder under wp-content/themes, and the stylesheet handle. Left empty it comes from the theme name.

Left empty the header line is left out rather than written blank.

The Template header. It must match the parent's own folder exactly, or WordPress refuses to activate the child.

Parent kind

A block parent has templates/ and theme.json; a classic one has PHP template files.

The handle the parent registers its style.css under. The child depends on it so the child CSS wins.

theme.json version

Version 3 needs WordPress 6.6 or newer. Use 2 for older sites.

Comma separated, and only needed for a theme you submit to WordPress.org.

Create this folder: wp-content/themes/my-child-theme

Write the three files a child theme is made of, with the Template header, the stylesheet handle and the load order already correct.

How to use

  1. Name the theme, then set the folder name. They are different things: the name shows in Appearance, the folder is what goes in wp-content/themes.
  2. Set the parent folder name exactly as it appears on disk. Template: twentytwentyfive, not Twenty Twenty-Five. A mismatch is the one error that stops the child activating at all.
  3. Say whether the parent is a block theme or a classic one. It decides whether theme.json is worth writing, and what the enqueue has to do.
  4. Put the parent’s stylesheet handle in. For Twenty Twenty-Five it is twentytwentyfive-style; for others, search the parent’s functions.php for wp_enqueue_style. The child style then depends on it and loads after it.
  5. Copy each tab into a file of that name inside the new folder, add a screenshot.png at 1200 by 900, then activate the child in Appearance, Themes.

Example

A child of Twenty Twenty-Five with the defaults gives three files. style.css carries the header:

/*
Theme Name: My Child Theme
Description: A child theme of Twenty Twenty-Five.
Author: Your Name
Author URI: https://example.com
Template: twentytwentyfive
Version: 1.0.0
Requires at least: 6.7
Tested up to: 7.1
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: my-child-theme
*/

functions.php loads that file after the parent’s, which is the whole reason for the dependency array:

add_action( 'wp_enqueue_scripts', 'my_child_theme_enqueue_styles' );

function my_child_theme_enqueue_styles() {
	wp_enqueue_style(
		'my-child-theme-style',
		get_stylesheet_uri(),
		array( 'twentytwentyfive-style' ),
		wp_get_theme()->get( 'Version' )
	);
}

And theme.json holds only what you override; every setting left out keeps coming from the parent.

Pitfalls

  • WordPress does not load a theme’s style.css for you. Block themes and classic themes alike enqueue it in functions.php, so a child with no functions.php has a stylesheet nothing reads.
  • The child’s functions.php runs before the parent’s, not after. Both files load, in that order, so you cannot redeclare a parent function unless the parent wrapped it in function_exists.
  • Twenty Twenty-Five and other recent block themes load style.min.css unless SCRIPT_DEBUG is on. Copying their enqueue and hardcoding /style.css loads a second, unminified copy.
  • wp_get_theme() returns the active theme, so inside a child it gives the child’s version. Fine for cache-busting your own file, wrong for the parent’s: that needs wp_get_theme()->parent().
  • A theme.json in the child replaces the parent’s value for each key you name. Give settings.color.palette and you lose the parent’s whole palette, not just the colours you listed.
  • templates/ and parts/ files in the child override the parent’s file of the same name entirely. There is no partial override, so copy the parent’s file first and edit it.
  • Editing a template in the Site Editor saves it to the database, not to your child theme files. Export the theme to get those changes back onto disk.
  • Renaming the child folder after activation deactivates the theme, because the stylesheet path is what WordPress stores.

Compatibility

Every file is also downloadable as a single .zip, built in your browser. The archive stores the files rather than deflating them, which is what WordPress’s own installer reads, and the whole set goes in a folder named after the theme, so Appearance → Themes → Add New → Upload installs it directly. The writer was checked by installing what it produces through WP-CLI on WordPress 7.1.2, activating it, and loading the home page.

Child themes work on every WordPress version in use; the Template header is how they have been declared since 2.0. theme.json needs WordPress 5.8, version 2 of the format needs 5.9, and version 3 needs 6.6. load_child_theme_textdomain has been available since 2.9. Nothing here is theme-specific: the same files work with a classic parent, with the parent enqueue turned on if the parent never loads its own stylesheet. The tool runs entirely in your browser.

Frequently asked questions

Why is my child theme unstyled after activating?
Either functions.php is missing, or the parent style handle is wrong so the child CSS loads before the parent’s and gets overridden. Check the handle in the parent’s functions.php.
Do I need to copy the parent’s functions.php?
No. Both files load, the child’s first. Copy only the code you want to change, and only if the parent guarded it with function_exists.
Does a block theme child need functions.php?
Yes, if it has CSS. theme.json and template overrides work without it, but style.css is only loaded by an enqueue.
What about the screenshot?
screenshot.png at 1200 by 900 in the child folder. Without it the theme shows a blank tile in Appearance, Themes; it changes nothing else.
Can I change the parent later?
Only by editing Template and re-checking every template override, since they are named after the parent’s files. In practice that is a new child theme.

From the people who built this tool

WP Adminify

The WordPress admin, rebuilt: a dashboard worth looking at, menu and column control, a real file manager and the login page your client sees.

See WP Adminify Free version on WordPress.org

Weekly drops

New tools, when there are new tools

One email when something worth using ships. No schedule to fill, so no filler.

Your address goes nowhere else, and one click unsubscribes.