In wordpress (ideally, without using a plug-in) on the tag page, I would like to show the number of posts tagged with the tag.
Example: There are 8 posts tagged "baseball" when you are on the baseball tag page, he says: "There are 8 posts about baseball"
He must dynamically know which page of tags to receive the invoice and print it. I found several options for static input of the name or identifier of the tag and return of the number, but my attempts to make them work dynamically were not available.
This is what I worked 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 would be greatly appreciated!
source share