WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Display Post count with single Tag

[Resolved] Display Post count with single Tag

  • Hello,

    I need to display a single tag and the post count associated with it. For example,

    Summer (4)

    Thanks for assistance

Viewing 4 replies - 1 through 4 (of 4 total)
  • Untested

    <?php
    //assuming your tag id is 44
    $tags = get_tags('include=44');
    if ($tags) {
    foreach ($tags as $tag) {
    echo '<p>Tag: ' . $tag->name  . '(' . $tag->count . ')</p>';
    }
    }
    ?>

    Exactly what I wanted!

    Thanks

    I just modified the echo line to create a link to the tag posts (borrowed from http://wordpress.org/support/topic/230594 posted by you)

    This is great for doing each tag individually, but how about if we wanted to display a tag cloud with the post count on each tag.

    Example, Summer (4), Spring (19), Autumn (7), Winter (2) …etc…

    I looked but there doesn’t seem to be a show_count option on the tags like there is on the categories.

    Thanks.

    The reason for a cloud is to let the size ‘describe’ the approximate number of results for each entry in the cloud.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Display Post count with single Tag’ is closed to new replies.