wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



_inject_theme_attribute_in_template_part_block › WordPress Function

Od6.4.0
Przestarzałyn/a
_inject_theme_attribute_in_template_part_block ( $block )
Dostęp:
  • private
Parametry:
  • (array) $block a parsed block.
    Wymagane: Tak
Zdefiniowane na:
Codex:

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



Źródło

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