Changeset 935 for trunk/wp-includes/template-functions-general.php
- Timestamp:
- 02/25/2004 05:38:21 PM (23 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/template-functions-general.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-general.php
r933 r935 240 240 } 241 241 242 $now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600))); 242 $add_hours = intval($time_difference); 243 $add_minutes = intval(60 * ($time_difference - $add_hours)); 244 $wp_posts_post_date_field = "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; 245 246 $now = current_time('mysql'); 243 247 244 248 if ('monthly' == $type) { 245 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR( post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);249 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR($wp_posts_post_date_field) AS `year`, MONTH($wp_posts_post_date_field) AS `month`, count(ID) as posts FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' GROUP BY YEAR($wp_posts_post_date_field), MONTH($wp_posts_post_date_field) ORDER BY post_date DESC" . $limit); 246 250 if ($arcresults) { 247 251 foreach ($arcresults as $arcresult) { … … 257 261 } 258 262 } elseif ('daily' == $type) { 259 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR( post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);263 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR($wp_posts_post_date_field) AS `year`, MONTH($wp_posts_post_date_field) AS `month`, DAYOFMONTH($wp_posts_post_date_field) AS `dayofmonth` FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 260 264 if ($arcresults) { 261 265 foreach ($arcresults as $arcresult) { … … 270 274 $start_of_week = 1; 271 275 } 272 $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK( post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);276 $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK($wp_posts_post_date_field, $start_of_week) AS `week`, YEAR($wp_posts_post_date_field) AS yr, DATE_FORMAT($wp_posts_post_date_field, '%Y-%m-%d') AS yyyymmdd FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 273 277 $arc_w_last = ''; 274 278 if ($arcresults) { … … 289 293 } 290 294 } elseif ('postbypost' == $type) { 291 $arcresults = $wpdb->get_results("SELECT ID, post_date, post_title FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);295 $arcresults = $wpdb->get_results("SELECT ID, $wp_posts_post_date_field, post_title FROM $tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 292 296 if ($arcresults) { 293 297 foreach ($arcresults as $arcresult) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)