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:
emc3 2004-05-20 14:07:55 +00:00
parent 035ff03f95
commit 44344bdcd7
1 changed files with 125 additions and 123 deletions

View File

@ -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,