描述:
获取一个主题或者插件支持的功能
用法:
<?php get_theme_support( $feature ); ?>
参数:
$feature
(string) (必填) 要添加的功能的名称.
默认值: None
Features list:
- Sidebar Widgets
- Navigation Menus
- Post Formats
- Post Thumbnails
- Custom Backgrounds
- Custom Headers
- Automatic Feed Links
- Editor Style
源文件:
function get_theme_support( $feature ) {
global $_wp_theme_features;
if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
return false;
}
if ( func_num_args() <= 1 ) {
return $_wp_theme_features[ $feature ];
}
$args = array_slice( func_get_args(), 1 );
switch ( $feature ) {
case 'custom-logo':
case 'custom-header':
case 'custom-background':
if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) ) {
return $_wp_theme_features[ $feature ][0][ $args[0] ];
}
return false;
default:
return $_wp_theme_features[ $feature ];
}
}