A child theme lets you edit theme code and keep your changes when the parent theme updates. Changes made in the parent theme files are lost at the next update.
CSS Changes Need No Child Theme
For CSS only, use one of these routes.
- Classic themes: the Additional CSS field at AppearanceCustomizeAdditional CSS..
- Block themes: AppearanceEditorStyles. Click the More button (three dots), then Additional CSS.
- Any theme: the SiteOrigin CSS plugin, which has a visual editor.
How Child Themes Work
A template file in the child theme folder, such as header.php or single.php, replaces the parent copy. The child functions.php runs in addition to the parent functions.php. Copy only the files you change.
Block theme templates you edit in the Site Editor are saved in the database. They survive theme updates without a child theme.
WordPress has a full child theme guide.
Download a Starter Child Theme
Classic Admin Screens: Install and Activate
- Go to AppearanceThemesAdd ThemeUpload Theme.
- Choose the child theme zip and click Install Now.
- Click Activate.
You can also upload the unzipped folder to /wp-content/themes/ by FTP, then activate it at AppearanceThemes.
Create a Child Theme by Hand
This example makes a child of the Puro theme. Ultra and Polestar work the same way with a different Template value.
- Create the folder
/wp-content/themes/puro-child/. The folder can have any name. The parent name plus-childis the usual choice. - Add a
style.cssfile with the header below. - Add a
functions.phpfile with the code for your theme. - Activate the child theme as above.
style.css
Template must match the parent theme folder name exactly: puro, ultra or polestar.
/* Theme Name: Puro Child Author: Puro Author URI: https://purothemes.com/ Theme URI: https://purothemes.com/themes/puro/ Description: Puro Child Theme Version: 1.0.0 Template: puro Text Domain: puro-child */
Add your own CSS below the header. Do not copy the whole parent style.css.
functions.php for Puro and Ultra
These themes load the active theme’s style.css, which is the child file. The child functions.php only loads the parent stylesheet first.
function puro_child_scripts() {
wp_enqueue_style( 'puro-parent-style', get_template_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'puro_child_scripts', 8 );functions.php for Polestar
Polestar always loads its own stylesheet from the parent folder. The child functions.php loads the child stylesheet after it.
function polestar_child_scripts() {
wp_enqueue_style( 'polestar-child', get_stylesheet_directory_uri() . '/style.css', array( 'polestar-style' ) );
}
add_action( 'wp_enqueue_scripts', 'polestar_child_scripts' );Move Customizer Settings
Customizer settings belong to the theme that was active when you saved them. To copy them to a child theme, follow the guide on migrating Customizer settings.
Block Themes
A child of a block theme uses the same folder, style.css header and upload steps. It needs no functions.php file to load styles. Add a theme.json file to override the parent settings.
Change a Parent Function
You cannot replace a single function by copying functions.php. Use filter and action hooks in the child functions.php. ThemeShaper explains filter hooks and action hooks in child themes.