WordPress.org

Make WordPress Core

Changeset 4025


Ignore:
Timestamp:
07/21/2006 07:03:21 PM (14 years ago)
Author:
ryan
Message:

Don't let get_calendar travel into the future. Props Mark Jaquith. fixes #2961

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/wp-includes/template-functions-general.php

    r3771 r4025  
    400400    global $wpdb, $m, $monthnum, $year, $timedifference, $month, $month_abbrev, $weekday, $weekday_initial, $weekday_abbrev, $posts;
    401401
    402     // Quick check. If we have no posts at all, abort!
     402    $now = current_time('mysql');
     403
     404    // Quick check. If we have no posts yet published, abort!
    403405    if ( !$posts ) {
    404         $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_status = 'publish' AND post_date < '$now' ORDER BY post_date DESC LIMIT 1");
    405407        if ( !$gotsome )
    406408            return;
     
    448450        FROM $wpdb->posts
    449451        WHERE post_date >   '$thisyear-$thismonth-01'
     452        AND post_date < '$now'
    450453        AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' )
    451454        AND post_status = 'publish'
Note: See TracChangeset for help on using the changeset viewer.