get_theme_feature_list [ WordPress Function ]
get_theme_feature_list ( $api = true )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: install_themes_feature_list, get_the_term_list, get_the_category_list, get_the_tag_list, get_theme_updates
Retrieve list of WordPress theme features (aka theme tags)
Source
<?php
function get_theme_feature_list( $api = true ) {
// Hard-coded list is used if api not accessible.
$features = array(
__('Colors') => array(
'black' => __( 'Black' ),
'blue' => __( 'Blue' ),
'brown' => __( 'Brown' ),
'gray' => __( 'Gray' ),
'green' => __( 'Green' ),
'orange' => __( 'Orange' ),
'pink' => __( 'Pink' ),
'purple' => __( 'Purple' ),
'red' => __( 'Red' ),
'silver' => __( 'Silver' ),
'tan' => __( 'Tan' ),
'white' => __( 'White' ),
'yellow' => __( 'Yellow' ),
'dark' => __( 'Dark' ),
'light' => __( 'Light' ),
),
__('Columns') => array(
'one-column' => __( 'One Column' ),
'two-columns' => __( 'Two Columns' ),
'three-columns' => __( 'Three Columns' ),
'four-columns' => __( 'Four Columns' ),
'left-sidebar' => __( 'Left Sidebar' ),
'right-sidebar' => __( 'Right Sidebar' ),
),
__('Width') => array(
'fixed-width' => __( 'Fixed Width' ),
'flexible-width' => __( 'Flexible Width' ),
),
__( 'Features' ) => array(
'blavatar' => __( 'Blavatar' ),
'buddypress' => __( 'BuddyPress' ),
'custom-background' => __( 'Custom Background' ),
'custom-colors' => __( 'Custom Colors' ),
'custom-header' => __( 'Custom Header' ),
'custom-menu' => __( 'Custom Menu' ),
'editor-style' => __( 'Editor Style' ),
'featured-image-header' => __( 'Featured Image Header' ),
'featured-images' => __( 'Featured Images' ),
'front-page-post-form' => __( 'Front Page Posting' ),
'full-width-template' => __( 'Full Width Template' ),
'microformats' => __( 'Microformats' ),
'post-formats' => __( 'Post Formats' ),
'rtl-language-support' => __( 'RTL Language Support' ),
'sticky-post' => __( 'Sticky Post' ),
'theme-options' => __( 'Theme Options' ),
'threaded-comments' => __( 'Threaded Comments' ),
'translation-ready' => __( 'Translation Ready' ),
),
__( 'Subject' ) => array(
'holiday' => __( 'Holiday' ),
'photoblogging' => __( 'Photoblogging' ),
'seasonal' => __( 'Seasonal' ),
)
);
if ( ! $api || ! current_user_can( 'install_themes' ) )
return $features;
if ( !$feature_list = get_site_transient( 'wporg_theme_feature_list' ) )
set_site_transient( 'wporg_theme_feature_list', array( ), 10800);
if ( !$feature_list ) {
$feature_list = themes_api( 'feature_list', array( ) );
if ( is_wp_error( $feature_list ) )
return $features;
}
if ( !$feature_list )
return $features;
set_site_transient( 'wporg_theme_feature_list', $feature_list, 10800 );
$category_translations = array( 'Colors' => __('Colors'), 'Columns' => __('Columns'), 'Width' => __('Width'),
'Features' => __('Features'), 'Subject' => __('Subject') );
// Loop over the wporg canonical list and apply translations
$wporg_features = array();
foreach ( (array) $feature_list as $feature_category => $feature_items ) {
if ( isset($category_translations[$feature_category]) )
$feature_category = $category_translations[$feature_category];
$wporg_features[$feature_category] = array();
foreach ( $feature_items as $feature ) {
if ( isset($features[$feature_category][$feature]) )
$wporg_features[$feature_category][$feature] = $features[$feature_category][$feature];
else
$wporg_features[$feature_category][$feature] = $feature;
}
}
return $wporg_features;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/get theme feature list « WordPress Codex
Description. Retrieve list of WordPress theme features (aka theme tags). Usage. <?php get_theme_feature_list() ?> Parameters. None. Return Values ...
codex.wordpress.org - Docs for page theme.php
get_theme_feature_list (line 151). Retrieve list of WordPress theme ... array get_theme_feature_list ([bool $api = true]). bool $api: Optional. Whether try to fetch ...
phpdoc.wordpress.org - #14936 (Improve theme searching/browsing) – WordPress Trac
(In [15655]) get_theme_feature_list() replaces install_themes_feature_list(). Does translation and works if feature_list is not accessible from api.wordpress.org.
core.trac.wordpress.org - wp-admin/includes/theme-install.php source
p> 83 84 <form method="get" action=""> 85 <input type="hidden" name="tab" value="search" /> 86 <?php 87 $feature_list = get_theme_feature_list( ); 88 echo ...
phpxref.ftwr.co.uk