Need help with child enqueue code
-
I’ve read a lot of good help on this, but, with new, and limited, wp and js skills, I want to make sure of my understanding.
To allow the parent theme (‘hashi’) to evolve, I’m using a child theme (‘hashi-child’) to capture unique (e.g. ‘special’) and override element (e.g. ‘h1’) styles. The directory and styles.css files have been created. My understanding is that to create the enqueue cascade I need a functions.php file with some js, and, when created, activate the hashi-child theme to implement.
The codex for enqueue has recommended js to do this (below). Is the ” $parent_style = ‘hashi’ ” the only change I need or do I also need to change the name for the child in the second wp_enqueue statement?
<?php
function my_theme_enqueue_styles() {$parent_style = ‘parent-style’; // This is ‘twentyfifteen-style’ for the Twenty Fifteen theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘child-style’,
get_stylesheet_directory_uri() . ‘/style.css’,
array( $parent_style ),
wp_get_theme()->get(‘Version’)
);
}
add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
?>
The topic ‘Need help with child enqueue code’ is closed to new replies.