From a0556647afffc5fe218e9f93544d1874d5106807 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Wed, 23 Nov 2005 07:57:58 +0000 Subject: [PATCH] Don't show 0 as a month. git-svn-id: https://develop.svn.wordpress.org/trunk@3202 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-functions.php | 2 +- wp-admin/edit.php | 3 ++- wp-includes/template-functions-general.php | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 3b071a8e19..82377d0ee8 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -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) { diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 135e385ac0..d1a98c0cec 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -81,7 +81,8 @@ if ( is_month() ) { -get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts ORDER BY post_date DESC"); +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) ) { ?>
diff --git a/wp-includes/template-functions-general.php b/wp-includes/template-functions-general.php index ff96256f67..ebc170a95d 100644 --- a/wp-includes/template-functions-general.php +++ b/wp-includes/template-functions-general.php @@ -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);