Count posts within a custom post type and specific category

Category wise post count in wordpress

Senior Developer Asked on January 23, 2017 in WORDPRESS.
Add Comment
1 Answer(s)
<?php $args = array( 'orderby' => 'name', 'order' => 'ASC' ); 
$categories = get_categories($args); 
foreach($categories as $category) { ? >
 <a href="<?php echo get_category_link( $category->term_id );?>">
<p ><?php echo $category->name;?><span >(<?php echo $category->count;?>)</span></p>
</a> <?php } ?>
Team Leader Answered on March 19, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.