wc_get_theme_support()
Return "theme support" values from the current theme, if set.
Хуков нет.
Возвращает
Разное. Value of prop(s).
Использование
wc_get_theme_support( $prop, $default );
- $prop(строка)
- Name of prop (or key::subkey for arrays of props) if you want a specific value. Leave blank to get all props as an array.
По умолчанию:'' - $default(разное)
- Optional value to return if the theme does not declare support for a prop.
По умолчанию:null
Список изменений
| С версии 3.3.0 | Введена. |
Код wc_get_theme_support() wc get theme support WC 10.8.1
function wc_get_theme_support( $prop = '', $default = null ) {
$theme_support = get_theme_support( 'woocommerce' );
$theme_support = is_array( $theme_support ) ? $theme_support[0] : false;
if ( ! $theme_support ) {
return $default;
}
if ( $prop ) {
$prop_stack = explode( '::', $prop );
$prop_key = array_shift( $prop_stack );
if ( isset( $theme_support[ $prop_key ] ) ) {
$value = $theme_support[ $prop_key ];
if ( count( $prop_stack ) ) {
foreach ( $prop_stack as $prop_key ) {
if ( is_array( $value ) && isset( $value[ $prop_key ] ) ) {
$value = $value[ $prop_key ];
} else {
$value = $default;
break;
}
}
}
} else {
$value = $default;
}
return $value;
}
return $theme_support;
}