You can quickly create a WordPress child theme by creating a new theme directory and adding these two files.
style.css
/*
* Theme Name: My Child Theme
* Template: twentynineteen
*/
Where the Template
value is the directory name of the parent theme (in this case, we’re making a child theme of Twenty Nineteen, which is found in the twentynineteen
directory).
functions.php
<?php
/**
* Child theme functions.php
*
* @author Sal Ferrarello
* @package salcode/childTheme
*/
add_action( 'wp_enqueue_scripts', 'fe_enqueue_parent_theme_style' );
/**
* Enqueue parent theme style
*
* @author Sal Ferrarello
*/
function fe_enqueue_parent_theme_style() {
wp_enqueue_style(
'parent-theme-style',
get_template_directory_uri() . '/style.css',
array(), // Dependencies.
'0.1.0', // Version.
'all' // Media.
);
}
Official Child Theme Documentation
See the WordPress Official Child Theme Documentation
Leave a Reply