Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




current_theme_supports [ WordPress Function ]

current_theme_supports ( $feature )
Parameters:
  • (string) $feature the feature being checked
Returns:
  • (boolean)
Defined at:



Checks a theme's support for a given feature

Source


<?php
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() <= )
        return 
true;

    
$args array_slicefunc_get_args(), );

    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;

        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] );
            break;
    }

    return 
apply_filters('current_theme_supports-' $featuretrue$args$_wp_theme_features[$feature]);
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics