Prints a block template part.
Parameters
$part
stringrequired- The block template part to print, for example
'header'
or'footer'
.
Source
$block_template = apply_filters( 'pre_get_block_file_template', null, $id, $template_type );
if ( ! is_null( $block_template ) ) {
return $block_template;
}
$parts = explode( '//', $id, 2 );
if ( count( $parts ) < 2 ) {
Changelog
Version | Description |
---|---|
5.9.0 | Introduced. |
Note that this outputs the content of the template part, and does not use any parameters added to the template part itself.
In other words,
If you have a template part, and you are adding it inside a HTML block template in a block theme with these parameters:
Using block_template_part() to output the same template part in a PHP template, does not output the wrapping footer element and the
site-footer
CSS class.