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
檢視更多 >