esden
Forum Replies Created
-
Forum: Installing WordPress
In reply to: wp_list_cats ignoring optionall?I have created a version of the code posted before so that you also see the count of posts in the “All” category. Here the apropriate diff:
--- template-functions-category.php.old 2005-07-10 15:10:09.143933008 +0200
+++ template-functions-category.php 2005-07-10 14:55:44.831328496 +0200
@@ -283,10 +283,12 @@
WHERE post_status = 'publish'
AND post_date_gmt < '$now' $exclusions
GROUP BY category_id");
+ $category_posts["0"] = 0;
if (! empty($cat_counts)) {
foreach ($cat_counts as $cat_count) {
if (1 != intval($hide_empty) || $cat_count > 0) {
$category_posts["$cat_count->cat_ID"] = $cat_count->cat_count;
+ $category_posts["0"] += intval($cat_count->cat_count);
}
}
}
@@ -302,10 +304,23 @@
$category_timestamp["$cat_date->category_id"] = $cat_date->ts;
}
}
-
+
$num_found=0;
$thelist = "";+ if (intval($optionall) == 1 && !$child_of && $categories) {
+ $all = apply_filters('list_cats', $all);
+ $link = "<a href="".$file.'?cat=0">'.$all."</a>";
+ if (intval($optioncount) == 1) {
+ $link .= ' ('.intval($category_posts["0"]).')';
+ }
+ if ($list) {
+ $thelist .= "\t<li>$link</li>\n";
+ } else {
+ $thelist .= "\t$linkn";
+ }
+ }
+
foreach ($categories as $category) {
if ((intval($hide_empty) == 0 || isset($category_posts["$category->cat_ID"])) && (!$hierarchical || $category->category_parent == $child_of) ) {
$num_found++;