Im having a problem to register and load a gallery css code from my home page. Rest of the styles are loading fine, but this flexslider is not registering. Any guidance appreciated.
<?php
function theme_styles() {
wp_enqueue_style ('normalize', get_template_directory_uri() . '/css/normalize.css');
wp_enqueue_style ('grid', get_template_directory_uri() . '/css/grid.css');
wp_enqueue_style ('main', get_template_directory_uri() . '/style.css');
wp_register_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.css' );
if( is_page( 'home' ) ) {
wp_enqueue_style( 'flexslider' );
}
}
add_action( 'wp_enqueue_scripts', 'theme_styles' );
// Enable custom menus
add_theme_support( 'menus' );
?>
The primary issue is an incorrect template conditional tag:
This returns true if the current context is a static page, with the slug
home
. I presume that you’re actually wanting to test for the Site Front Page – in which case you need to use theis_front_page()
conditional:If the stylesheet still isn’t being output, we’ll need further debugging information.
Try removing all points of failure and do what you know will work without any question. Then move forward from there one step at a time.
This is what I would do first just to make sure I am not completely insane!
Then if that is outputting then move forward. If not, fairly simple fix at that point. Coding really is full-time trouble shooting. 🙂