On the archive page, I want to display how many posts are covered by the relevant category / tag archive.
The following code shows the number of posts of a category:
<div class="archive_number"> This category contains <?php $cat = get_the_category(); $cat = $cat; echo $cat->category_count; ?> posts </div>
Now, I want to display the number of posts filed under a tag. I've tried it with the following code:
<div class="archive_number"> <?php $tag = get_query_var('tag_id'); $tag = $tag; echo $tag->tag_count; ?> posts are filed under this tag. </div>
But (of course) this does not work. Any ideas what I do wrong? Be patient, I'm a php n00b.
Thanks for your help.