On this page
block_template_part( string $part )
Prints a block template part.
Parameters
$partstring Required-
The block template part to print. Use "header" or "footer".
Source
File: wp-includes/block-template-utils.php. View all references
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 );
}
Related
Uses
| Uses | Description |
|---|---|
| get_block_template() wp-includes/block-template-utils.php | Retrieves a single unified template object using its id. |
| do_blocks() wp-includes/blocks.php | Parses dynamic blocks out of |
| get_stylesheet() wp-includes/theme.php | Retrieves name of the current stylesheet. |
Used By
| Used By | Description |
|---|---|
| block_header_area() wp-includes/block-template-utils.php | Prints the header block template part. |
| block_footer_area() wp-includes/block-template-utils.php | Prints the footer block template part. |
Changelog
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/block_template_part