Definition:
function current_theme_supports( $feature ) {}
Checks a theme’s support for a given feature
Parameters
- string $feature: the feature being checked
Source code
function current_theme_supports( $feature ) {
global $_wp_theme_features;
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 );
// @todo Allow pluggable arg checking
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] );
break;
case 'post-formats':
// specific post formats can be registered by passing an array of types to
// add_theme_support()
$post_format = $args[0];
return in_array( $post_format, $_wp_theme_features[$feature][0] );
break;
}
return true;
}
752

February 11, 2011 


No comments yet... Be the first to leave a reply!