block_template_part()WP 5.9.0

Prints a block template part.

No Hooks.

Return

null. Nothing.

Usage

block_template_part( $part );
$part(string) (required)
The block template part to print. Use "header" or "footer".

Changelog

Since 5.9.0 Introduced.

block_template_part() code WP 6.1.1

function block_template_part( $part ) {
	$template_part = get_block_template( get_stylesheet() . '//' . $part, 'wp_template_part' );
	if ( ! $template_part || empty( $template_part->content ) ) {
		return;
	}
	echo do_blocks( $template_part->content );
}