I am creating a child theme for my site and inside my functions.php I added a code to load a specific css file ONLY where it is the HOME page:
// enqueue styles for child theme
function wowdental_enqueue_styles() {
// enqueue parent styles
wp_enqueue_style('Divi', get_template_directory_uri() .'/style.css', get_the_time() );
// Flip3d css
wp_enqueue_style( 'flip', get_stylesheet_directory_uri() . '/css/flip.css', get_the_time() );
// flip3d only on home page
if( is_home() ) {
wp_enqueue_style('flip');
}
}
add_action('wp_enqueue_scripts', 'wowdental_enqueue_styles');
I placed the condition for if is_home() but the stylesheet gets pulled in ALL pages regardless of whether home page or not.
I have also used if (is_home() || is_front_page() ) but I get the same result.
What am I doing wrong here??