block_template_part

函数
block_template_part ( $part )
参数
  • (string) $part The block template part to print. Use "header" or "footer".
    Required:
定义位置
相关方法
_get_block_templates_pathsget_template_partget_block_templaterender_block_core_template_part_filter_block_template_part_area
引入
5.9.0
弃用
-

block_template_part: 这个函数类似于WordPress中的get_template_part函数,但用于加载特定于块的模板: 该函数需要两个参数:区块类型(例如”core/paragraph”)和模板名称(例如”content”)。

打印区块模板部分。

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

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-14 09:36:28

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: