I have a category list showing in one of my WordPress page. currently it is showing all the category names with link. I want to show the post number too. means if category A have 10 post it ll show beside its name.
here is my current snippet:
<ul class="cat-list">
<?php
$args=array(
'orderby' => 'name',
'order' => 'ASC'
)
?>
<?php
foreach (get_categories( $args ) as $cat) : ?>
<li>
<div class="post-title">
<h5><a href="<?php echo get_category_link($cat->term_id); ?>"><i class="fa fa-arrow-circle-right"></i> <?php echo $cat->cat_name; ?></a></h5>
</div>
</li>
<?php endforeach; ?>
</ul>
here is what I want to do:
Try some thing like this when you looping to get ‛category_count‛
This link may help you here
https://wordpress.org/support/topic/display-the-posts-count-in-the-selected-category