Show Tag Number

Hello,

I am trying to display the number of posts that have been tagged by a certain tag.

For example, If I have 20 posts that are tagged with the tag “music”. I would like to be able to call something so that it would show (20) and update as I tag more posts with the “music” tag.

I have found this http://codex.wordpress.org/Function_Reference/get_the_tags

and at the very bottom it mentions

count
number of uses of this tag, total
but I can not figure out how to use it.

Could any one lend a hand?

Thank you very much!!

Something like this?

foreach (get_the_tags() as $tag){
  echo "<li>";
  echo get_tag_link($tag->term_id);
  echo get_tag_link($tag->count);
  echo "</li>";
}

I haven’t tried this - just checked the codex and modified their example a bit.

Does that help?

RockyShark,

Thank you for trying!

I do not think the code produces the desired results.

It outputs a list of the urls of all of the tags on the current post.

I currently use

get_usernumposts($userid_here)); ?>

to display the number of posts a certain user has.

I was hoping to find something like

get_tagnumposts($tagid_here)); ?>

My goal is to be able to see how many times a certain tag is used in my entire site from a static page.

Do you happen to have any ideas? I thought that the “count” function in my previous post might be it, but I am not sure.

Thank you for your help!!! I greatly appreciate it.

Ah, okay. I misunderstood your question.

That function only applies to tags attached to a specific post I think.

I was thinking you might be able to use this: http://codex.wordpress.org/Template_Tags/wp_tag_cloud - and choose ‘format’ => ‘list’ - that will give you a list of tags used sitewide, and you can order them by count, but it doesn’t seem to be able to output the count.

Dunno…