mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 10:44:26 +00:00
Post status = future. #2426
git-svn-id: https://develop.svn.wordpress.org/trunk@3514 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -110,17 +110,16 @@ function get_lastpostdate($timezone = 'server') {
|
||||
global $cache_lastpostdate, $pagenow, $wpdb;
|
||||
$add_seconds_blog = get_settings('gmt_offset') * 3600;
|
||||
$add_seconds_server = date('Z');
|
||||
$now = current_time('mysql', 1);
|
||||
if ( !isset($cache_lastpostdate[$timezone]) ) {
|
||||
switch(strtolower($timezone)) {
|
||||
case 'gmt':
|
||||
$lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
|
||||
$lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
|
||||
break;
|
||||
case 'blog':
|
||||
$lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
|
||||
$lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
|
||||
break;
|
||||
case 'server':
|
||||
$lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
|
||||
$lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
|
||||
break;
|
||||
}
|
||||
$cache_lastpostdate[$timezone] = $lastpostdate;
|
||||
@@ -134,17 +133,16 @@ function get_lastpostmodified($timezone = 'server') {
|
||||
global $cache_lastpostmodified, $pagenow, $wpdb;
|
||||
$add_seconds_blog = get_settings('gmt_offset') * 3600;
|
||||
$add_seconds_server = date('Z');
|
||||
$now = current_time('mysql', 1);
|
||||
if ( !isset($cache_lastpostmodified[$timezone]) ) {
|
||||
switch(strtolower($timezone)) {
|
||||
case 'gmt':
|
||||
$lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
|
||||
$lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
|
||||
break;
|
||||
case 'blog':
|
||||
$lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
|
||||
$lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
|
||||
break;
|
||||
case 'server':
|
||||
$lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
|
||||
$lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
|
||||
break;
|
||||
}
|
||||
$lastpostdate = get_lastpostdate($timezone);
|
||||
@@ -1350,12 +1348,10 @@ function get_posts($args) {
|
||||
if ( !isset($r['order']) )
|
||||
$r['order'] = 'DESC';
|
||||
|
||||
$now = current_time('mysql');
|
||||
|
||||
$posts = $wpdb->get_results(
|
||||
"SELECT DISTINCT * FROM $wpdb->posts " .
|
||||
( empty( $r['category'] ) ? "" : ", $wpdb->post2cat " ) .
|
||||
" WHERE post_date <= '$now' AND (post_type = 'post' AND post_status = 'publish') ".
|
||||
" WHERE (post_type = 'post' AND post_status = 'publish') ".
|
||||
( empty( $r['category'] ) ? "" : "AND $wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = " . $r['category']. " " ) .
|
||||
" GROUP BY $wpdb->posts.ID ORDER BY " . $r['orderby'] . " " . $r['order'] . " LIMIT " . $r['offset'] . ',' . $r['numberposts'] );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user