RE: How to get all post categories and number of post count?

How to get all post categories and number of post count?

rajesh Trainee Asked on March 4, 2017 in WORDPRESS.
Add Comment
1 Answers

<?php

$args = array(

'orderby' => 'date',

'order' => 'DESC'

);

$categories = get_categories($args);

foreach($categories as $category) { ?>
<div class="speacial_category_txt"><a href="<?php echo get_category_link( $category->term_id );?>"><?php echo $category->name;?> {<?php echo $category->category_count;?>}</a></div>
<?php } ?>
Team Leader Answered on March 9, 2017.
Add Comment

Your Answer

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