WordPress.org

Support

Support » Plugins and Hacks » query posts AFTER a date

query posts AFTER a date

  • how can i query posts AFTER a date (todays), the >= operator doesn’t seem to work

    this is what i have

    <?php $current_day = date(‘d’); ?>
    <?php $current_month = date(‘m’); ?>
    <?php $current_year = date(‘Y’); ?>

    <?php query_posts(“year>=$current_year&monthnum>=$current_month&day>=$current_day&order=ASC”); ?>
    <!– put your loop here –>

    if i change the operator to = it will return only posts on that date, but the above code, which i thought would return posts after a date doesn’t work?

    NB i am very unfamiliar with PHP although i have a lot of experience on the dark side (microsoft/ASP). i am SERIOUSLY impressed with WordPress after only a couple of evenings i’ve managed to put together a very versatile CMS for my site.
    The reason for wanting posts after todays date is that i’m using an events category with the “allow future dates” plugin, i only want to show events that are coming up, not those that have passed.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘query posts AFTER a date’ is closed to new replies.