benecaster_get_header()
benecaster_get_header( ?string $name = null ): void
Prints the site header in a way that works on both classic and block themes. On a block theme it renders the header block template part; on a classic theme it calls get_header(); on a theme that has neither, it prints nothing and stays quiet.
That last case is the reason it exists. Calling get_header() directly from a plugin template on a block theme fills the debug log with deprecation notices, which is alarming to a podcaster who has done nothing wrong. If you are overriding templates/episode/single.php, templates/show/single.php, or templates/archive/archive.php in your theme, swap get_header() for this and the notices stop.
Its counterpart is benecaster_get_footer().
Parameters
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
$name |
string|null |
null |
No | Optional specialised header name, passed straight through to get_header() on classic themes. Ignored on block themes, which have no equivalent concept. |
Return Value
Type:
void
Nothing. The header markup is printed directly.
Example
<?php benecaster_get_header(); ?>
<main class="benecaster-episode-single">
<?php benecaster_get_template_part( 'episode/title', [ 'episode_id' => $episode_id ] ); ?>
</main>
<?php benecaster_get_footer(); ?>
Need this built rather than just documented? See our services →