Switch language

wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren




wp_count_terms [ WordPress Function ]

wp_count_terms ( $taxonomy, $args = array() )
Parameter:
  • (string) $taxonomy Taxonomy name
  • (array|string) $args Overwrite defaults. See get_terms()
Nutzt:
Gibt zurück:
  • (int) How many terms are in $taxonomy
Definiert in:



Count how many terms are in Taxonomy.

Default $args is 'hide_empty' which can be 'hide_empty=true' or array('hide_empty' => true).

Source


<?php
function wp_count_terms$taxonomy$args = array() ) {
    
$defaults = array('hide_empty' => false);
    
$args wp_parse_args($args$defaults);

    
// backwards compatibility
    
if ( isset($args['ignore_empty']) ) {
        
$args['hide_empty'] = $args['ignore_empty'];
        unset(
$args['ignore_empty']);
    }

    
$args['fields'] = 'count';

    return 
get_terms($taxonomy$args);
}
?>

Beispiele [ wp-snippets.com ]

Top Google Suchergebnisse

Mehr ...

Nutzerduskussionen [ wordpress.org ]

0 Nutzerkommentare

Noch keine. Sei der Erste!

Neu hinzufügen ...



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