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



wp_apply_custom_classname_support › WordPress Function

Od5.6.0
Przestarzałyn/a
wp_apply_custom_classname_support ( $block_type, $block_attributes )
Dostęp:
  • private
Parametry: (2)
  • (WP_Block_Type) $block_type Block Type.
    Wymagane: Tak
  • (array) $block_attributes Block attributes.
    Wymagane: Tak
Powrót:
  • (array) Block CSS classes and inline styles.
Zdefiniowane na:
Codex:

Adds the custom classnames to the output.



Źródło

function wp_apply_custom_classname_support( $block_type, $block_attributes ) {
	$has_custom_classname_support = block_has_support( $block_type, 'customClassName', true );
	$attributes                   = array();
	if ( $has_custom_classname_support ) {
		$has_custom_classnames = array_key_exists( 'className', $block_attributes );

		if ( $has_custom_classnames ) {
			$attributes['class'] = $block_attributes['className'];
		}
	}

	return $attributes;
}