Changeset 996 for trunk/wp-includes/template-functions-general.php
- Timestamp:
- 03/25/2004 01:45:07 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-general.php
r973 r996 241 241 $add_hours = intval($time_difference); 242 242 $add_minutes = intval(60 * ($time_difference - $add_hours)); 243 $wp_posts_post_date_field = " DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";243 $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; 244 244 245 245 $now = current_time('mysql'); 246 246 247 247 if ('monthly' == $type) { 248 $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);248 $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 249 if ($arcresults) { 250 250 foreach ($arcresults as $arcresult) { … … 260 260 } 261 261 } elseif ('daily' == $type) { 262 $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);262 $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 263 if ($arcresults) { 264 264 foreach ($arcresults as $arcresult) { … … 271 271 } elseif ('weekly' == $type) { 272 272 $start_of_week = get_settings('start_of_week'); 273 $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 $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); 274 274 $arc_w_last = ''; 275 275 if ($arcresults) { … … 290 290 } 291 291 } elseif ('postbypost' == $type) { 292 $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 $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); 293 293 if ($arcresults) { 294 294 foreach ($arcresults as $arcresult) { … … 324 324 $add_hours = intval($time_difference); 325 325 $add_minutes = intval(60 * ($time_difference - $add_hours)); 326 $wp_posts_post_date_field = " DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";326 $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; 327 327 328 328 // Let's figure out when we are … … 344 344 } 345 345 } else { 346 $thisyear = gmdate('Y', current_time('timestamp') );347 $thismonth = gmdate('m', current_time('timestamp') );346 $thisyear = gmdate('Y', current_time('timestamp') + $time_difference * 3600); 347 $thismonth = gmdate('m', current_time('timestamp') + $time_difference * 3600); 348 348 } 349 349 … … 353 353 $previous = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year 354 354 FROM $tableposts 355 WHERE $wp_posts_post_date_field< '$thisyear-$thismonth-01'355 WHERE post_date < '$thisyear-$thismonth-01' 356 356 AND post_status = 'publish' 357 357 ORDER BY post_date DESC 358 358 LIMIT 1"); 359 $next = $wpdb->get_row("SELECT DISTINCT MONTH( $wp_posts_post_date_field) AS month, YEAR($wp_posts_post_date_field) AS year359 $next = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year 360 360 FROM $tableposts 361 361 WHERE post_date > '$thisyear-$thismonth-01' … … 406 406 407 407 // Get days with posts 408 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH( $wp_posts_post_date_field)409 FROM $tableposts WHERE MONTH( $wp_posts_post_date_field) = $thismonth408 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date) 409 FROM $tableposts WHERE MONTH(post_date) = $thismonth 410 410 AND YEAR(post_date) = $thisyear 411 411 AND post_status = 'publish' … … 430 430 431 431 $ak_titles_for_day = array(); 432 $ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH( $wp_posts_post_date_field) as dom "432 $ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH(post_date) as dom " 433 433 ."FROM $tableposts " 434 ."WHERE YEAR( $wp_posts_post_date_field) = '$thisyear' "435 ."AND MONTH( $wp_posts_post_date_field) = '$thismonth' "434 ."WHERE YEAR(post_date) = '$thisyear' " 435 ."AND MONTH(post_date) = '$thismonth' " 436 436 ."AND post_date < '".current_time('mysql')."' " 437 437 ."AND post_status = 'publish'" … … 502 502 function the_date_xml() { 503 503 global $post; 504 echo mysql2date('Y-m-d', get_date_from_gmt($post->post_date));504 echo mysql2date('Y-m-d', $post->post_date); 505 505 //echo ""+$post->post_date; 506 506 } … … 512 512 $the_date .= $before; 513 513 if ($d=='') { 514 $the_date .= mysql2date(get_settings('date_format'), get_date_from_gmt($post->post_date));514 $the_date .= mysql2date(get_settings('date_format'), $post->post_date); 515 515 } else { 516 $the_date .= mysql2date($d, get_date_from_gmt($post->post_date));516 $the_date .= mysql2date($d, $post->post_date); 517 517 } 518 518 $the_date .= $after; … … 530 530 global $id, $post; 531 531 if ($d=='') { 532 $the_time = mysql2date(get_settings('time_format'), get_date_from_gmt($post->post_date));533 } else { 534 $the_time = mysql2date($d, get_date_from_gmt($post->post_date));532 $the_time = mysql2date(get_settings('time_format'), $post->post_date); 533 } else { 534 $the_time = mysql2date($d, $post->post_date); 535 535 } 536 536 $the_time = apply_filters('the_time', $the_time); … … 544 544 function the_weekday() { 545 545 global $weekday, $id, $post; 546 $the_weekday = $weekday[mysql2date('w', get_date_from_gmt($post->post_date))];546 $the_weekday = $weekday[mysql2date('w', $post->post_date)]; 547 547 $the_weekday = apply_filters('the_weekday', $the_weekday); 548 548 echo $the_weekday; … … 554 554 if ($day != $previousweekday) { 555 555 $the_weekday_date .= $before; 556 $the_weekday_date .= $weekday[mysql2date('w', get_date_from_gmt($post->post_date))];556 $the_weekday_date .= $weekday[mysql2date('w', $post->post_date)]; 557 557 $the_weekday_date .= $after; 558 558 $previousweekday = $day;
Note: See TracChangeset
for help on using the changeset viewer.