[ad_1]
Hi. I’m currently finishing up styling a child theme of Twenty Twenty-Four, and I’m not sure of the code that I should use to enqueue the child theme’s CSS stylsheet.
The child themes page of WordPress Developer Resources provides two versions of the code:
Version 1:
add_action( 'wp_enqueue_scripts', 'grand_sunrise_enqueue_styles' );
function grand_sunrise_enqueue_styles() {
wp_enqueue_style(
'grand-sunrise-style',
get_stylesheet_uri()
);
}Version 2:
add_action( 'wp_enqueue_scripts', 'grand_sunrise_enqueue_styles' );
function grand_sunrise_enqueue_styles() {
wp_enqueue_style(
'grand-sunrise-parent-style',
get_parent_theme_file_uri( 'style.css' )
);
}I was going to use the following code for my child theme, hlcbpc, but I’m not sure if it’s correct;
add_action( 'wp_enqueue_scripts', 'hlcpbc_styles' );
function hlcpbc_styles() {
wp_enqueue_style(
'hlcpbc-style',
get_stylesheet_uri( 'style.css' )
);
}So, my child theme’s functions.php file would have the following:
<?php
/**
* hlcpbc functions and definitions
*
* @link https://developer.projectdmc.org/themes/basics/theme-functions/
*
*/
/**
* Register block styles.
*/
add_action( 'wp_enqueue_scripts', 'hlcpbc_styles' );
function hlcpbc_styles() {
wp_enqueue_style(
'hlcpbc-style',
get_stylesheet_uri( 'style.css' )
);
}Thanks in advance for your help.
