関数 current_theme_supports()
2014/12/17
関数 current_theme_supports()
定義ファイル :/blog/wp-includes/theme.php 4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | function current_theme_supports( $feature ) { global $_wp_theme_features; if ( 'custom-header-uploads' == $feature ) return current_theme_supports( 'custom-header', 'uploads' ); if ( !isset( $_wp_theme_features[$feature] ) ) return false; // If no args passed then no extra checks need be performed if ( func_num_args() <= 1 ) return true; $args = array_slice( func_get_args(), 1 ); switch ( $feature ) { case 'post-thumbnails': // post-thumbnails can be registered for only certain content/post types by passing // an array of types to add_theme_support(). If no array was passed, then // any type is accepted if ( true === $_wp_theme_features[$feature] ) // Registered for all types return true; $content_type = $args[0]; return in_array( $content_type, $_wp_theme_features[$feature][0] ); case 'html5': case 'post-formats': // specific post formats can be registered by passing an array of types to // add_theme_support() // Specific areas of HTML5 support *must* be passed via an array to add_theme_support() $type = $args[0]; return in_array( $type, $_wp_theme_features[$feature][0] ); case 'custom-header': case 'custom-background' : // specific custom header and background capabilities can be registered by passing // an array to add_theme_support() $header_support = $args[0]; return ( isset( $_wp_theme_features[$feature][0][$header_support] ) && $_wp_theme_features[$feature][0][$header_support] ); } return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[$feature] ); } |