Added checks to category functions for empty results.
git-svn-id: http://svn.automattic.com/wordpress/trunk@432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4574bd5dcb
commit
240c3ea9d8
|
@ -1047,6 +1047,7 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
|
||||||
$all = apply_filters('list_cats', $all);
|
$all = apply_filters('list_cats', $all);
|
||||||
echo "\t<option value='all'>$all</option>\n";
|
echo "\t<option value='all'>$all</option>\n";
|
||||||
}
|
}
|
||||||
|
if ($categories) {
|
||||||
foreach ($categories as $category) {
|
foreach ($categories as $category) {
|
||||||
$cat_name = apply_filters('list_cats', $category->cat_name);
|
$cat_name = apply_filters('list_cats', $category->cat_name);
|
||||||
echo "\t<option value=\"".$category->cat_ID."\"";
|
echo "\t<option value=\"".$category->cat_ID."\"";
|
||||||
|
@ -1061,6 +1062,7 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
|
||||||
}
|
}
|
||||||
echo "</option>\n";
|
echo "</option>\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
echo "</select>\n";
|
echo "</select>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1087,6 +1089,15 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
||||||
$query .= " ORDER BY $sort_column $sort_order, post_date DESC";
|
$query .= " ORDER BY $sort_column $sort_order, post_date DESC";
|
||||||
|
|
||||||
$categories = $wpdb->get_results($query);
|
$categories = $wpdb->get_results($query);
|
||||||
|
|
||||||
|
if (!$categories) {
|
||||||
|
if ($list) {
|
||||||
|
$before = '<li>';
|
||||||
|
$after = '</li>';
|
||||||
|
}
|
||||||
|
echo $before . "No categories" . $after . "\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
++$querycount;
|
++$querycount;
|
||||||
if (intval($optionall) == 1) {
|
if (intval($optionall) == 1) {
|
||||||
$all = apply_filters('list_cats', $all);
|
$all = apply_filters('list_cats', $all);
|
||||||
|
@ -1094,6 +1105,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
||||||
if ($list) echo "\n\t<li>$link</li>";
|
if ($list) echo "\n\t<li>$link</li>";
|
||||||
else echo "\t$link<br />\n";
|
else echo "\t$link<br />\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($categories as $category) {
|
foreach ($categories as $category) {
|
||||||
$cat_name = apply_filters('list_cats', $category->cat_name);
|
$cat_name = apply_filters('list_cats', $category->cat_name);
|
||||||
$link = '<a href="'.$file.$querystring_start.'cat'.$querystring_equal.$category->cat_ID.'">';
|
$link = '<a href="'.$file.$querystring_start.'cat'.$querystring_equal.$category->cat_ID.'">';
|
||||||
|
|
Loading…
Reference in New Issue