wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



_inject_theme_attribute_in_template_part_block › WordPress Function

Depuis6.4.0
Dépréciéen/a
_inject_theme_attribute_in_template_part_block ( $block )
Accès:
  • private
Paramètres:
  • (array) $block a parsed block.
    Requis: Oui
Défini(e) dans:
Codex:

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



Source

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