functions.php How to add css/js depending on Template Name?
You can use wp_enqueue_style() before running get_header() in your blue.php file. If you’re looking for a way to do that inside your functions.php file, then the init hook is a bit too early for is_page_template(). Try the wp_enqueue_scripts hook instead: add_action( ‘wp_enqueue_scripts’, ‘load_my_theme_files’ ); function load_my_theme_files() { if ( is_page_template( ‘blue.php’ ) ) { wp_enqueue_style( … Read more