Enqueue scripts to a specific header-.php?

You load the header file probably with get_header(). There is a hook you can use: 'get_header'. You get the called header name as parameter.

add_action( 'get_header', 'wpse_54865_conditional_enqueue' );

function wpse_54865_conditional_enqueue( $name )
{
    if ( 'my_custom_header_name' === $name )
    {
        // register your script loading function
    }
}

Leave a Comment