I have a question.
How can I count number of posts of a tag ?
Example : Tag photos (67)
Thanks
Simply copy the [sbs_posts] shortcode and add it to any WordPress post, page, or shortcode enabled sidebar widget. It will show the total number of published posts on your WordPress site. You can also use [sbs_blog_stats] which will show all blog stats including the total number of posts.
Perhaps the easiest way to get the total number of tags is to open PI System Management Tools (aka PI SMT) and navigate to the 'Points' tool in the lower left pane. Expand it to locate the 'Point Source Table'. Here you will find your pi points count by point source.
Easy way to count category is: 1) firstly fetch all category from wordpress 2) count them using simple php funciton complete code will be like: <? php $args = array( 'parent' => 0, 'hide_empty' => 0 ); $categories = get_categories( $args ); echo "Total categories : ". count( $categories ); ?>
By default, there is no limit to the number of tags you can assign. But a post with a lot of tags may not look good in your WordPress theme. We say add no more than 10 tags to your posts unless you can justify it.
Use the code below:
$taxonomy = "category"; // can be category, post_tag, or custom taxonomy name
// Using Term Slug
$term_slug = 'some-category';
$term = get_term_by('slug', $term_slug, $taxonomy);
// Fetch the count
echo $term->count;
See here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With