I can't get the correct css file to load for my page template. The page is correctly loading the template but still using the default css file.
This is the code I'm using to load the page template's css file:
if (is_page_template('page-templates/page-nosidebar.php')) {
wp_enqueue_style('authorLuncheon-layout-style', get_template_directory_uri() . '/layouts/no-sidebar.css');
} else {
wp_enqueue_style('authorLuncheon-layout-style', get_template_directory_uri() . '/layouts/content-sidebar.css');
}
This is the whole function that contains the code above:
function authorluncheon_scripts() {
wp_enqueue_style( 'authorluncheon-style', get_stylesheet_uri() );
if (is_page_template('page-templates/page-nosidebar.php')) {
wp_enqueue_style('authorLuncheon-layout-style', get_template_directory_uri() . '/layouts/no-sidebar.css');
} else {
wp_enqueue_style('authorLuncheon-layout-style', get_template_directory_uri() . '/layouts/content-sidebar.css');
}
wp_enqueue_script( 'authorluncheon-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'authorluncheon-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
Thanks for any help!