Changeset 3510 for trunk/wp-includes/template-functions-general.php
- Timestamp:
- 02/09/2006 10:03:48 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-general.php
r3493 r3510 331 331 332 332 if ( 'monthly' == $type ) { 333 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_date < '$now' AND post_date != '0000-00-00 00:00:00' AND post_ status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);333 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_date < '$now' AND post_date != '0000-00-00 00:00:00' AND post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); 334 334 if ( $arcresults ) { 335 335 $afterafter = $after; … … 346 346 } 347 347 } elseif ( 'daily' == $type ) { 348 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_date < '$now' AND post_date != '0000-00-00 00:00:00' AND post_ status = 'publish' ORDER BY post_date DESC" . $limit);348 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_date < '$now' AND post_date != '0000-00-00 00:00:00' AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 349 349 if ( $arcresults ) { 350 350 foreach ( $arcresults as $arcresult ) { … … 357 357 } elseif ( 'weekly' == $type ) { 358 358 $start_of_week = get_settings('start_of_week'); 359 $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 $wpdb->posts WHERE post_date < '$now' AND post_ status = 'publish' ORDER BY post_date DESC" . $limit);359 $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 $wpdb->posts WHERE post_date < '$now' AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 360 360 $arc_w_last = ''; 361 361 if ( $arcresults ) { … … 374 374 } 375 375 } elseif ( 'postbypost' == $type ) { 376 $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_date < '$now' AND post_ status = 'publish' ORDER BY post_date DESC" . $limit);376 $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_date < '$now' AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 377 377 if ( $arcresults ) { 378 378 foreach ( $arcresults as $arcresult ) { … … 404 404 // Quick check. If we have no posts at all, abort! 405 405 if ( !$posts ) { 406 $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_ status = 'publish' ORDER BY post_date DESC LIMIT 1");406 $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1"); 407 407 if ( !$gotsome ) 408 408 return; … … 444 444 FROM $wpdb->posts 445 445 WHERE post_date < '$thisyear-$thismonth-01' 446 AND post_ status = 'publish'446 AND post_type = 'post' AND post_status = 'publish' 447 447 ORDER BY post_date DESC 448 448 LIMIT 1"); … … 451 451 WHERE post_date > '$thisyear-$thismonth-01' 452 452 AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) 453 AND post_ status = 'publish'453 AND post_type = 'post' AND post_status = 'publish' 454 454 ORDER BY post_date ASC 455 455 LIMIT 1"); … … 509 509 FROM $wpdb->posts WHERE MONTH(post_date) = $thismonth 510 510 AND YEAR(post_date) = $thisyear 511 AND post_ status = 'publish'511 AND post_type = 'post' AND post_status = 'publish' 512 512 AND post_date < '" . current_time('mysql') . '\'', ARRAY_N); 513 513 if ( $dayswithposts ) { … … 532 532 ."AND MONTH(post_date) = '$thismonth' " 533 533 ."AND post_date < '".current_time('mysql')."' " 534 ."AND post_ status = 'publish'"534 ."AND post_type = 'post' AND post_status = 'publish'" 535 535 ); 536 536 if ( $ak_post_titles ) {
Note: See TracChangeset
for help on using the changeset viewer.