i am trying to load custom layout style for index.php. My theme is called kendo and i am trying to pull some custom stylesheets in functions.php
Stylesheets work separately (if i delete one line for example), but they keep overriding each other. Is something wrong with my code?
function kendo_scripts() {
wp_enqueue_style( 'kendo-style', get_stylesheet_uri() );
if (is_page_template('index')) {
wp_enqueue_style( 'kendo-layout-style1', get_template_directory_uri() . '/layouts/no-sidebar.css' );
}
if (!is_page_template('index')) {
wp_enqueue_style( 'kendo-layout-style2', get_template_directory_uri() . '/layouts/content-sidebar.css' );
}
You are using wrong parameter for
is_page_template
hook. Use full template filename with extension.index.php
notindex
.See function is_page_template reference.
This was the possible issues. A sample code:
See also 2 reference answers in StackExchange: one and two
Wouldn't adding this to header.php be easier...