Fixed list_cats support for hide_empty and optioncount. Also fixed indentation in that function.

git-svn-id: https://develop.svn.wordpress.org/trunk@1328 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dougal Campbell 2004-05-20 14:07:55 +00:00
parent b5cdc60beb
commit 7fbb072b49
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,