How to load different CSS in different Header?

Enqueue style depending on a template filename:

if('header.php' == basename( get_page_template() ) { // check the template file name
    // enqueue header.php style here
}

if('header-full.php' == basename( get_page_template() ) { // check the template file name
    // enqueue header-full.php style here
}

wp_enqueue_style already registers a style so you don’t need to register a style before enqueueing it except in very special cases. See wp_enqueue_style.

Leave a Comment