Fixed list_cats support for hide_empty and optioncount. Also fixed indentation in that function.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
035ff03f95
commit
44344bdcd7
|
@ -293,7 +293,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
|||
|
||||
$categories = $wpdb->get_results($query);
|
||||
}
|
||||
if (intval($hide_empty) == 1 && !isset($category_posts)) {
|
||||
if (!count($category_posts)) {
|
||||
$cat_counts = $wpdb->get_results(" SELECT cat_ID,
|
||||
COUNT($tablepost2cat.post_id) AS cat_count
|
||||
FROM $tablecategories
|
||||
|
@ -302,9 +302,11 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
|||
WHERE post_status = 'publish' $exclusions
|
||||
GROUP BY category_id");
|
||||
foreach ($cat_counts as $cat_count) {
|
||||
if (1 != intval($hide_empty) || $cat_count > 0) {
|
||||
$category_posts["$cat_count->cat_ID"] = $cat_count->cat_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (intval($optiondates) == 1) {
|
||||
$cat_dates = $wpdb->get_results(" SELECT cat_ID,
|
||||
|
|
Loading…
Reference in New Issue