Ticket #15202: general-template.diff
File general-template.diff, 2.4 KB (added by , 12 years ago) |
---|
-
trunk/wp-includes/general-template.php
1129 1129 $unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear); 1130 1130 $last_day = date('t', $unixmonth); 1131 1131 1132 $join = apply_filters( 'getcalendar_join', '' ); 1133 $where = apply_filters( 'getcalendar_where', "AND post_type = 'post' AND post_status = 'publish'" ); 1134 1132 1135 // Get the next and previous month and year with at least one post 1133 1136 $previous = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year 1134 FROM $wpdb->posts 1135 WHERE post_date < '$thisyear-$thismonth-01' 1136 AND post_type = 'post' AND post_status = 'publish' 1137 FROM $wpdb->posts $join 1138 WHERE post_date < '$thisyear-$thismonth-01' $where 1137 1139 ORDER BY post_date DESC 1138 1140 LIMIT 1"); 1139 1141 $next = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year 1140 FROM $wpdb->posts 1141 WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59' 1142 AND post_type = 'post' AND post_status = 'publish' 1142 FROM $wpdb->posts $join 1143 WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59' $where 1143 1144 ORDER BY post_date ASC 1144 1145 LIMIT 1"); 1145 1146 … … 1192 1193 1193 1194 // Get days with posts 1194 1195 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date) 1195 FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'1196 AND post_type = 'post' AND post_status = 'publish'1197 AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' ", ARRAY_N);1196 FROM $wpdb->posts $join 1197 WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' 1198 AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' $where", ARRAY_N); 1198 1199 if ( $dayswithposts ) { 1199 1200 foreach ( (array) $dayswithposts as $daywith ) { 1200 1201 $daywithpost[] = $daywith[0]; … … 1210 1211 1211 1212 $ak_titles_for_day = array(); 1212 1213 $ak_post_titles = $wpdb->get_results("SELECT ID, post_title, DAYOFMONTH(post_date) as dom " 1213 ."FROM $wpdb->posts " 1214 ."FROM $wpdb->posts " 1215 .$join 1214 1216 ."WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' " 1215 1217 ."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' " 1216 . "AND post_type = 'post' AND post_status = 'publish'"1218 .$where 1217 1219 ); 1218 1220 if ( $ak_post_titles ) { 1219 1221 foreach ( (array) $ak_post_titles as $ak_post_title ) {