I think that option only works for dropdown_cats.
Any confirmation on that?
Well, prior to the upgrade, it was working just fine in a list.
I got the same problem in WP 1.5, in WP 1.2.2 the wp_list_cats succesfully displayed what I want
It code that handles the optionall/all parameters was removed from list_cats()
. I’ve no idea why. If you need it back, look in
wp-includes/template-functions.category.php
for the function list_cats()
. In this, just before the line:
foreach ($categories as $category) {
insert this:
if (intval($optionall) == 1 && !$child_of && $categories) {
$all = apply_filters('list_cats', $all);
$link = "<a href=\"".$file.'?cat=0">'.$all."</a>";
if ($list) {
echo "nt<li>$link</li>";
} else {
echo "t$link<br />n";
}
}
This is a mod from 1.2’s source. The query string ?cat=all
doesn’t seem to work either, so I’ve used 0 (zero) in the code above to call up all categories.
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++;