Don't show 0 as a month.

git-svn-id: https://develop.svn.wordpress.org/trunk@3202 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg 2005-11-23 07:57:58 +00:00
parent 7193d2f5e4
commit a0556647af
3 changed files with 5 additions and 4 deletions

View File

@ -494,7 +494,7 @@ function checked($checked, $current) {
function return_categories_list($parent = 0) {
global $wpdb;
return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent");
return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY category_count DESC LIMIT 100");
}
function sort_cats($cat1, $cat2) {

View File

@ -81,7 +81,8 @@ if ( is_month() ) {
</fieldset>
</form>
<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts ORDER BY post_date DESC");
<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_date != '0000-00-00 00:00:00' ORDER BY post_date DESC");
if ( count($arc_result) ) { ?>
<form name="viewarc" action="" method="get" style="float: left; width: 20em; margin-bottom: 1em;">

View File

@ -323,7 +323,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
$now = current_time('mysql');
if ( 'monthly' == $type ) {
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_date < '$now' AND post_date != '0000-00-00 00:00:00' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);
if ( $arcresults ) {
$afterafter = $after;
foreach ( $arcresults as $arcresult ) {
@ -338,7 +338,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
}
}
} elseif ( 'daily' == $type ) {
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_date < '$now' AND post_date != '0000-00-00 00:00:00' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
if ( $arcresults ) {
foreach ( $arcresults as $arcresult ) {
$url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth);