Support

Account

Home Forums General Issues Ordering event posts by date

Solved

Ordering event posts by date

  • Hi,

    I was reading the ACF guide on pre_get_posts at the end of the page.

    That part works fine for me but I’m trying to get the soonest events first, but the old events still at the end.

    Order by date ASC if the date is in the future
    AND
    Order by date DEC if the date is in the past

    Example

    1. Upcoming event – July 2022
    2. Upcoming event – August 2022
    3. Upcoming event – September 2022
    4. Past event – June 2022
    5. Past event – May 2022
    6. Past event – April 2022

    Is this possible with a single WP_Query?

  • No, it is not possible to do this with a single WP Query.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.