WordPress.org

Support

Support » How-To and Troubleshooting » category_count; – Equivalent for all terms? Tags, Taxonomies, etc?

category_count; – Equivalent for all terms? Tags, Taxonomies, etc?

  • Ian

    @ianaleksander

    I’ve been playing around with the new 3.1 calls, using them to trim my code. Especially in conditionals.

    I’m using these on my archive page. I’ve got: <?php single_term_title(); ?> Instead of a seperate one for tag, taxonomy, and cat, which allowed me to take it out of the if statement. Awesome! I’ve also got <?php echo term_description(); ?>. Same deal!
    But what about the count?

    I’m using:

    $term = get_category ($cat);
    echo  $term->category_count;

    But I can’t figure out an equivalent for tag or taxonomy. Even better than equivalents would be one that does it all!
    Any ideas?

    Also, kind of related, does anyone know how to check to see if there is a term description, and if not display some general text like “now viewing an archive page for <?php single_term_title(); ?> – Return home?”
    ps. if you guys didn’t know about the “term” stuff, check it out! it’s saving me a lot of work.

  • The topic ‘category_count; – Equivalent for all terms? Tags, Taxonomies, etc?’ is closed to new replies.
Skip to toolbar