There are a few problems with your code which I will take you through.
PROBLEM 1
Whether you are using
they all have the first parameter in common, $handle
. This is
$handle
(string) (required) Name of the stylesheet (which should be unique as it is used to identify the script in the whole system).
Default: None
As you can see, $handle
needs to be unique. You are using authorLuncheon-layout-style twice on two different stylesheets. Just remember though, if you are registering AND enqueueing a style or a script, the $handle
parameter for the same script or style must be the same in both functions
SOLUTION TO PROBLEM 1
You should change one of the duplicate $handle
s
PROBLEM 2
I don't know if you accidentally left it out or just did not add it in you theme, but you should always hook your function containing your script and styles to wp_enqueue_scripts
. This is the correct way, and my emphasis, only way to add scripts and styles to the front end of your theme
SOLUTION
Your code should look something like this. BTW, I will change my conditional to check that you are not on this specific page template (!is_page_template('page-templates/page-nosidebar.php'
), do something or else do something else, because you are most likely to use this specific page template less that any other template. I have already change the code, so you can just copy and paste it :-)
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-style2', get_template_directory_uri() . '/layouts/content-sidebar.css');
} else {
wp_enqueue_style('authorLuncheon-layout-style1', get_template_directory_uri() . '/layouts/no-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' );
}
}
add_action( 'wp_enqueue_scripts', 'authorluncheon_scripts' );