register_block_core_template_part

函数
register_block_core_template_part ( No parameters )

register_block_core_template_part: 这个函数在编辑器中注册了一个模板部分块的类型,并对其进行了设置。模板部分块允许用户在文章或页面内容中插入一个自定义的模板部分。

在服务器上注册”core/template-part”块。

function register_block_core_template_part() {
	register_block_type_from_metadata(
		__DIR__ . '/template-part',
		array(
			'render_callback' => 'render_block_core_template_part',
			'variations'      => build_template_part_block_variations(),
		)
	);
}

常见问题

FAQs
查看更多 >