Dominate Marketing

Dominate Marketing Logo
How To Guides Website Tips Wordpress

How to Make a WordPress Child Theme

Code you will need

Functions.php file

(make sure to save it as “functions.php”)

Version 1 (try this first):


add_action( ‘wp_enqueue_scripts’, ‘enqueue_parent_styles’ );
function enqueue_parent_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri().’/style.css’ );

Version 2:


// register and enqueue the stylesheet.
add_action( ‘wp_enqueue_scripts’, ‘register_child_theme_styles’ );

function register_child_theme_styles() {
wp_register_style( ‘style’, get_stylesheet_uri() );
wp_enqueue_style( ‘style’ );

Version 3:


add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
function my_theme_enqueue_styles() {
wp_enqueue_style( ‘child-style’, get_stylesheet_uri(),
array( ‘parenthandle’ ),
wp_get_theme()->get(‘Version’) // this only works if you have Version in the style header

Style.css code

(make sure to save the file as “style.css”)

Theme Name: Twenty Twenty Child
Template: twentytwenty