wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



_inject_theme_attribute_in_template_part_block › WordPress Function

Seit6.4.0
Veraltetn/v
_inject_theme_attribute_in_template_part_block ( $block )
Zugriff:
  • private
Parameter:
  • (array) $block a parsed block.
    Erforderlich: Ja
Definiert in:
Codex:

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



Quellcode

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