Changeset 15585
- Timestamp:
- 09/07/2010 04:22:56 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/general-template.php
r15564 r15585 1115 1115 1116 1116 $unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear); 1117 $last_day = date('t', $unixmonth); 1117 1118 1118 1119 // Get the next and previous month and year with at least one post 1119 $previous = $wpdb->get_row("SELECT DISTINCTMONTH(post_date) AS month, YEAR(post_date) AS year1120 $previous = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year 1120 1121 FROM $wpdb->posts 1121 1122 WHERE post_date < '$thisyear-$thismonth-01' … … 1123 1124 ORDER BY post_date DESC 1124 1125 LIMIT 1"); 1125 $next = $wpdb->get_row("SELECT DISTINCTMONTH(post_date) AS month, YEAR(post_date) AS year1126 $next = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year 1126 1127 FROM $wpdb->posts 1127 WHERE post_date > '$thisyear-$thismonth-01' 1128 AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) 1128 WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59' 1129 1129 AND post_type = 'post' AND post_status = 'publish' 1130 ORDER 1130 ORDER BY post_date ASC 1131 1131 LIMIT 1"); 1132 1132 … … 1180 1180 // Get days with posts 1181 1181 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date) 1182 FROM $wpdb->posts WHERE MONTH(post_date) = '$thismonth' 1183 AND YEAR(post_date) = '$thisyear' 1182 FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' 1184 1183 AND post_type = 'post' AND post_status = 'publish' 1185 AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);1184 AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N); 1186 1185 if ( $dayswithposts ) { 1187 1186 foreach ( (array) $dayswithposts as $daywith ) { … … 1200 1199 $ak_post_titles = $wpdb->get_results("SELECT ID, post_title, DAYOFMONTH(post_date) as dom " 1201 1200 ."FROM $wpdb->posts " 1202 ."WHERE YEAR(post_date) = '$thisyear' " 1203 ."AND MONTH(post_date) = '$thismonth' " 1204 ."AND post_date < '".current_time('mysql')."' " 1201 ."WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' " 1202 ."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' " 1205 1203 ."AND post_type = 'post' AND post_status = 'publish'" 1206 1204 );
Note: See TracChangeset
for help on using the changeset viewer.