Journal / Tutorial

Tutorial

A beginner's guide to WordPress child themes

A beginner's guide to WordPress child themes

If you've ever edited a theme's files directly and then lost every change on the next update, this tutorial is for you. A child theme solves that problem permanently, and it takes about five minutes to set up.

What a child theme actually is

A child theme is a small, separate theme that inherits everything from a "parent" theme — styles, templates, functionality — while letting you override just the pieces you want to change. WordPress loads the parent theme's code first, then lets the child theme's files take priority wherever they exist. Update the parent theme freely; your customizations live safely in the child and are never touched.

Step 1: create the folder

Inside wp-content/themes/, create a new folder — for example astra-child.

Step 2: add a style.css header

This is the only truly required file. It needs a comment header WordPress reads to register the theme, including the critical Template line, which must exactly match the parent theme's folder name:

/*
 Theme Name:   Astra Child
 Template:     astra
 Version:      1.0.0
*/

Step 3: enqueue the parent (and child) styles

Create a functions.php file in the same folder. Don't just @import the parent's CSS — that's slower and considered outdated. Enqueue it properly instead:

<?php
add_action( 'wp_enqueue_scripts', function () {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css',
        array( 'parent-style' ) );
});

Step 4: activate it

In Appearance → Themes, you'll now see your child theme listed separately from the parent. Activate it — visually nothing changes yet, because the child is currently empty and simply inherits everything.

Step 5: make your first override

Add any CSS to the child theme's style.css below the header comment, and it will override the parent's matching rules. Need to change a template file (like the header)? Copy that specific file from the parent theme into the same relative path inside the child theme, then edit the copy — WordPress will use your version instead.

One caveat: block (FSE) themes

Full-site-editing themes handle child theming a little differently, using theme.json overrides rather than template-file copying in most cases. The style.css header step above still applies, but check the parent theme's own documentation for FSE-specific guidance before overriding templates directly.

Why this matters for starter templates

Every template in this collection is built on a real, updatable parent theme. Setting up a child theme before you start customizing means you get the parent's future bug fixes and security updates for free, forever — without losing a single line of your own work.