W3cubDocs

/WordPress

block_template_part( string $part )

Prints a block template part.

Parameters

$partstringrequired
The block template part to print, for example 'header' or 'footer'.

Source

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 );
}

Changelog

Version Description
5.9.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/block_template_part