函数原型
block_template_part( string $part )
函数描述
Prints a block template part.
是否弃用
未弃用
函数参数
-
$part
string
Required - The block template part to print. Use "header" or "footer".
函数返回值
无
函数位置
File: wp-includes/block-template-utils.php.
函数源码
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 );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |

