wc_block_theme_has_styles_for_element()
Given an element name, returns true or false depending on whether the current theme has styles for that element defined in theme.json.
If the theme is not a block theme or the WP-related function is not defined, return false.
Хуков нет.
Возвращает
true|false
.
Использование
wc_block_theme_has_styles_for_element( $element );
- $element(строка) (обязательный)
- The name of the element.
Список изменений
С версии 7.4.0 | Введена. |
Код wc_block_theme_has_styles_for_element() wc block theme has styles for element WC 8.7.0
function wc_block_theme_has_styles_for_element( $element ) { if ( ! wc_current_theme_is_fse_theme() || wc_wp_theme_get_element_class_name( $element ) === '' ) { return false; } if ( function_exists( 'wp_get_global_styles' ) ) { $global_styles = wp_get_global_styles(); if ( array_key_exists( 'elements', $global_styles ) && array_key_exists( $element, $global_styles['elements'] ) ) { return is_array( $global_styles['elements'][ $element ] ); } } return false; }