How to sort categories by number of posts in wordpress

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
djyoti90
Forum Newbie
Posts: 1
Joined: Thu Feb 06, 2014 9:00 am

How to sort categories by number of posts in wordpress

Post by djyoti90 »

I'm using this syntax for ordering categories by the number of posts in each categories.

Code: Select all

<?php wp_list_categories('title_li=&show_count=1&child_of=3&number=5&orderby=count'); ?>
Still it's not working.. It shows the categories ordered alphabetically. Please help me!

You can check it here on the sidebar

http://www.primobazaar.com/
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: How to sort categories by number of posts in wordpress

Post by Celauran »

Syntax looks right. Are you sure it isn't ordering by count? Have you done a var_dump on the output? Otherwise displaying the count?
Post Reply