php - WordPress : is_page_template not working when called from wp_enqueue_scripts action -


i trying enqueue different css files depending on page template use.

the function is_page_template("index.php") called wp_enqueue_scripts action function (where styles , scripts called) returns false. use index.php template - reported "what file" plugin working template.

what way page template respect of adding scripts html header?

function the_scripts() {      if( is_page_template('index.php') ) {         print "this 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' ); 

i think ( is_page() && !is_page_template() ) work in wp_enqueue_scripts hook check if default page template in use.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -