WordPress.org

Ready to get started?Download WordPress

Forums

query posts AFTER a date (2 posts)

  1. mookster
    Member
    Posted 6 years ago #

    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.

  2. Bangbay Siboliban
    Member
    Posted 5 years ago #

    Check out the solution on this post:

    http://wordpress.org/support/topic/235706

Topic Closed

This topic has been closed to new replies.

About this Topic