Thread Starter
les2at
(@les2at)
To apply that patch open the file collapsing-categories/collapscatlist.php in some code editor locally and in it’s text:
1. Find the collapscat_orderbyfilter function and replace it with the following code:
function collapscat_orderbyfilter($orderby, $args='') {
global $options;
extract($options);
if ($catSort!='') {
/* les2 commented
if ($catSort=='catName') {
$orderby="t.name";
} elseif ($catSort=='catId') {
$orderby="t.term_id";
} elseif ($catSort=='catSlug') {
$orderby="t.slug";
} else
*/
if ($catSort=='catOrder') {
$orderby="t.term_order";
}
/* les2 commented
elseif ($catSort=='catCount') {
$orderby="tt.count";
}
*/
}
return $orderby;
}
Thread Starter
les2at
(@les2at)
2. Next, find the get_collapscat_fromdb function and insert between the lines
if ($showEmptyCat)
$args['hide_empty'] = false;
and
$categories = get_terms($taxonomy, $args);
the following code:
/* les2 added */
if ($catSort=='catName') {
$args['orderby']='name';
} elseif ($catSort=='catId') {
$args['orderby']='id';
} elseif ($catSort=='catSlug') {
$args['orderby']='slug';
}
/* les2: This is still handled in the collapscat_orderbyfilter function for get_terms_orderby filter
if ($catSort=='catOrder') {
$orderby="t.term_order";
}
*/
elseif ($catSort=='catCount') {
$args['orderby']='count';
}
/* end les2 added */
Of course, it would be well if developer of the Collapsing Categories plugin would merge the code of the pacth in the plugin sources.