_inject_theme_attribute_in_template_part_block

函式
_inject_theme_attribute_in_template_part_block ( $block )

將活動主題的樣式表作為 “theme” 屬性注入給定的模板部件區塊。

function _inject_theme_attribute_in_template_part_block( &$block ) {
	if (
		'core/template-part' === $block['blockName'] &&
		! isset( $block['attrs']['theme'] )
	) {
		$block['attrs']['theme'] = get_stylesheet();
	}
}

常見問題

FAQs
檢視更多 >