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.
A child theme is a WordPress theme that is built on top of another theme (the parent theme). It:
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.
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.style.css provides better organisation.You do NOT need a child theme for:
If all your customisations go through the Customizer or your theme's settings panel, you may not need a child theme.
Connect to your server via FTP (FileZilla) or open your hosting file manager.
Navigate to:
Create a new folder with a clear name identifying it as the child theme:
astra → Child: astra-childkadence → Child: kadence-childtwentytwentyfour → Child: twentytwentyfour-childInside your new child theme folder, create a file named style.css. Add the following content, replacing the values with your actual theme information:
/*
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
*/
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.
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
/**
* 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:
style.css in the source<link rel='stylesheet' id='astra-style-css'-css → astra-styleCommon parent theme style handles:
Astra → astra-styleKadence → kadence-styleGeneratePress → generate-styleOceanWP → oceanwp-styleTwenty Twenty-Four → twenty-twenty-four-style
If you'd rather not create files manually, the Child Theme Configurator plugin (free) handles the entire process through a GUI:
This is the simplest method for non-developers.
Add custom CSS directly in your child theme's style.css file, after the header comment block:
/* 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.
Add custom PHP functions to your child theme's 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' );
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
single.php (or the file you want to modify)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.style.css when you make changes. This is good practice for tracking evolution./* Increase line height for better readability on mobile - Added 2025-01-15 */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.