In wordpress (ideally, without having using a plug-in) on the tag page I must show the amount of posts which are labeled using the current tag.
Example: You will find 8 posts using the tag "baseball" when you're around the tag page for baseball it states, "You will find 8 posts about baseball"
It will dynamically know which tag page your on, obtain the count and print it. I've discovered a number of options for statically entering the tag title or ID and coming back the count but my tries to encourage them to work dynamically happen to be unsucessful.
This is exactly what I had been dealing with:
$taxonomy = "post_tag"; // can be category, post_tag, or custom taxonomy name // Using Term Name $term_name = single_cat_title; $term = get_term_by('name', $term_name, $taxonomy); // Fetch the count echo $term->count;
Any help could be greatly appreciated!
Open the file inside your template named "tag.php" and go into the preferred code inside it.
You can easily print the
found_posts property from the Wordpress Query object
Here's another possible solution from WP Recipes. These were kind enough to publish this the next day of I acquired a solution here. :)
<?php $feat_loop = new WP_Query( 'showposts=12&category_name=featured' ); echo "Query returned ".$feat_loop->post_count." posts."; ?>
It's different application but nonetheless very helpful!