Allow ordering by count.

git-svn-id: https://develop.svn.wordpress.org/trunk@4014 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-07-11 18:01:53 +00:00
parent 9b1204792a
commit 7337c5bbc0
1 changed files with 4 additions and 1 deletions

View File

@ -22,7 +22,10 @@ function &get_categories($args = '') {
$defaults = array('type' => 'post', 'child_of' => 0, 'orderby' => 'name', 'order' => 'ASC',
'hide_empty' => true, 'include_last_update_time' => false, 'hierarchical' => 1, $exclude => '', $include => '');
$r = array_merge($defaults, $r);
$r['orderby'] = "cat_" . $r['orderby']; // restricts order by to cat_ID and cat_name fields
if ( 'count' == $r['orderby'] )
$r['orderby'] = 'category_count';
else
$r['orderby'] = "cat_" . $r['orderby']; // restricts order by to cat_ID and cat_name fields
extract($r);
$where = 'cat_ID > 0';