I am trying to enqueue different css files depending on the page template I use.
The function is_page_template("index.php") called from wp_enqueue_scripts action function (where all styles and scripts are called) always returns false. I am certain that I use index.php template - it is also reported by "What the file" plugin as the working template.
What is the way to get the page template with respect of adding scripts to the html header?
function the_scripts() {
if( is_page_template('index.php') ) {
print "this is index.php";
} else {
print "failed";
}
}
wp_enqueue_style( [style_1], [path_1] );
...
wp_enqueue_style( [style_n], [path_n] );
}
add_action( 'wp_enqueue_scripts', 'the_scripts' );