Enqueue more than one child file styles in the child theme?
-
Hello,
I am using this code to enqueue a single css file in the functions.php file of my child theme:
function woodmart_child_enqueue_styles() {
wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'woodmart-style' ), woodmart_get_theme_info( 'Version' ) );
}
add_action( 'wp_enqueue_scripts', 'woodmart_child_enqueue_styles', 10010 );
It works fine, but I need to enqueue another file called: universal.css
Can you please tell me how to achieve this?
Regards,
Walter
Hello,
You can enqueue multiple CSS files by calling wp_enqueue_style() again for the additional file inside the same function.
For example:
function woodmart_child_enqueue_styles() {
wp_enqueue_style(
'child-style',
get_stylesheet_directory_uri() . '/style.css',
array('woodmart-style'),
woodmart_get_theme_info('Version')
);
wp_enqueue_style(
'universal-style',
get_stylesheet_directory_uri() . '/universal.css',
array('child-style'),
woodmart_get_theme_info('Version')
);
}
add_action('wp_enqueue_scripts', 'woodmart_child_enqueue_styles', 10010);
This will properly load universal.css after style.css.
Best Regards.
Hello,
You’re Most Welcome!
Feel free to write back anytime. If you need further assistance, we are always here to help you.
If you have a minute, we’d truly appreciate your feedback — it helps us improve the product and shape future updates more effectively. We’d love your feedback on our theme: https://tally.so/r/w4l54k
Thanks for contacting us.
Have a great day.
Topic Closed.
Best Regards.
The topic ‘Enqueue more than one child file styles in the child theme?’ is closed to new replies.