• Want to list the categories in the reverse ordering (with the most populated category first). Any help appreciated!

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The only solution I see is to have wp_list_categories() return the output instead of echoing it. This is assuming a non-hierarchical list. Strip out the outer <li>Title<ul> and the corresponding closing tags. explode() the remaining string on </li>, then sort the resulting array with a user function. The user function can extract the counts from the string fragments with preg_match() and use the values to decide what to return back to the array sort function. When done sorting, reassemble the strings for output.

    Either that or build your own function to list categories in order.

Viewing 1 replies (of 1 total)
  • The topic ‘wp_list_categories reverse order by count’ is closed to new replies.