Naming the usual practice when creating a child theme is to give its folder the same name as the parent theme appended with -child. That way, anyone knows immediately that this is the child of an existing theme.
Create the new style sheet.
This is the file that contains your theme’s CSS code and configuration for your theme’s design.
Add style sheet header which contains important information about your child theme.
Link to WordPress docs with a child theme template: https://developer.wordpress.org/themes/advanced-topics/child-themes/
Here’s a slimmed down version:
/*
Theme Name: Twenty Twenty-One Child
Description: A child theme of the Twenty Twenty-One default WordPress theme
Author: Brian Bellino
Template: twentytwentyone
Version: 1.0.0
*/
Enqueue stylesheet
Create functions.php
For version Twenty Twenty-One add the follow code:
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
$parenthandle = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
$theme = wp_get_theme();
wp_enqueue_style( $parenthandle, get_template_directory_uri() . '/style.css',
array(), // if the parent theme code has a dependency, copy it to here
$theme->parent()->get('Version')
);
wp_enqueue_style( 'child-style', get_stylesheet_uri(),
array( $parenthandle ),
$theme->get('Version') // this only works if you have Version in the style header
);
}