Skip to main content

Render the active theme’s header/footer from a Benecaster template override without deprecation on block themes

Free Beginner Since v1.0.0

The three outer plugin templates call benecaster_get_header() / benecaster_get_footer() instead of WP core get_header() / get_footer(). The helpers dispatch to block_template_part( 'header'/'footer' ) on block themes, fall back to core only when the active classic theme has the corresponding file, and silently render nothing otherwise. Theme overrides at {theme}/benecaster/show/single.php etc. should call the helpers to avoid deprecation log spam on FSE / block-theme sites.

Code

<?php
// wp-content/themes/my-theme/benecaster/show/single.php
benecaster_get_header();
do_action( 'benecaster_before_show_render', $show_id );
// ... your custom show markup ...
do_action( 'benecaster_after_show_render', $show_id );
benecaster_get_footer();