Allow ordering by count.

git-svn-id: http://svn.automattic.com/wordpress/trunk@4014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-07-11 18:01:53 +00:00
parent 0ad0948a92
commit 0f70c12715
1 changed files with 4 additions and 1 deletions

View File

@ -22,6 +22,9 @@ 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);
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);