Not with get_header()
, no. As you can see in the source of get_header()
the argument is simply appended to the filename and searched for in the root theme directory:
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "header-{$name}.php";
}
$templates[] = 'header.php';
locate_template( $templates, true );
And as far as I can tell there are no filters that would be useful here. As Justin Tadlock noted, this lack of filters has persisted for 8 years.
The next best thing you could do is to use get_template_part()
instead:
get_template_part( 'subdirectory/header', 'myname' );
But you’ll need your regular header in the subdirectory too.
The only thing you’ll miss out on doing it this way is that the get_header()
hook won’t fire. But you could remedy that by putting it at the beginning of your custom template:
do_action( 'get_header' );
or for the custom template:
do_action( 'get_header', 'myname' );
But honestly, I’m not sure how widely used that hook is, because it’s not very useful. You can probably get away with leaving it out.