Conditional Function To Enqueue Stylesheet
-
I have a parent theme and a child theme, both with their own style.css file.
My functions.php file has the following:
function theme_styles() { wp_enqueue_style( 'parent_bootstrap_css', get_template_directory_uri() . '/css/bootstrap.css' ); wp_enqueue_style( 'parent_style_css', get_template_directory_uri() . '/style.css' ); } add_action( 'wp_enqueue_scripts', 'theme_styles' );When using my child theme, I would like to modify the function to conditionally enqueue the child’s style.css when template_directory and stylesheet_directory are not the same.
Any help appreciated. Thanks!!!
The topic ‘Conditional Function To Enqueue Stylesheet’ is closed to new replies.