Ticket #8351: general-template.php.2.diff
File general-template.php.2.diff, 2.4 KB (added by , 16 years ago) |
---|
-
general-template.php
1005 1005 } 1006 1006 1007 1007 $unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear); 1008 $last_day = date('t', $unixmonth); 1008 1009 1009 1010 // Get the next and previous month and year with at least one post 1010 $previous = $wpdb->get_row("SELECT DISTINCTMONTH(post_date) AS month, YEAR(post_date) AS year1011 $previous = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year 1011 1012 FROM $wpdb->posts 1012 1013 WHERE post_date < '$thisyear-$thismonth-01' 1013 1014 AND post_type = 'post' AND post_status = 'publish' 1014 1015 ORDER BY post_date DESC 1015 1016 LIMIT 1"); 1016 $next = $wpdb->get_row("SELECT DISTINCTMONTH(post_date) AS month, YEAR(post_date) AS year1017 $next = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year 1017 1018 FROM $wpdb->posts 1018 WHERE post_date > '$thisyear-$thismonth-01' 1019 AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) 1019 WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59' 1020 1020 AND post_type = 'post' AND post_status = 'publish' 1021 ORDER 1021 ORDER BY post_date ASC 1022 1022 LIMIT 1"); 1023 1023 1024 1024 /* translators: Calendar caption: 1: month name, 2: 4-digit year */ … … 1074 1074 1075 1075 // Get days with posts 1076 1076 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date) 1077 FROM $wpdb->posts WHERE MONTH(post_date) = '$thismonth' 1078 AND YEAR(post_date) = '$thisyear' 1077 FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' 1079 1078 AND post_type = 'post' AND post_status = 'publish' 1080 AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);1079 AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N); 1081 1080 if ( $dayswithposts ) { 1082 1081 foreach ( (array) $dayswithposts as $daywith ) { 1083 1082 $daywithpost[] = $daywith[0]; … … 1094 1093 $ak_titles_for_day = array(); 1095 1094 $ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH(post_date) as dom " 1096 1095 ."FROM $wpdb->posts " 1097 ."WHERE YEAR(post_date) = '$thisyear' " 1098 ."AND MONTH(post_date) = '$thismonth' " 1099 ."AND post_date < '".current_time('mysql')."' " 1096 ."WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' " 1097 ."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' " 1100 1098 ."AND post_type = 'post' AND post_status = 'publish'" 1101 1099 ); 1102 1100 if ( $ak_post_titles ) {