wpseek.com
WordPress开发者和主题制作者的搜索引擎



_inject_theme_attribute_in_template_part_block › WordPress Function

Since6.4.0
已弃用n/a
› _inject_theme_attribute_in_template_part_block ( $block )
访问:
  • private
参数:
  • (array) $block a parsed block.
    Required: Yes
定义在:
文档:

Injects the active theme's stylesheet as a `theme` attribute into a given template part block.



源码

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