Home Forums Add-ons Repeater Field How to sort posts by dates after $today?


How to sort posts by dates after $today?

  • Hello!

    Say I have a cpt “events”, and these events will happen on multiple dates. I then add a repeater (event_dates_repeater) so that I can add all the dates (event_date) in which the event will take place. I want to query these posts on a page so that the next event that’ll happen will always be the first shown. However, having multiple dates inside a repeater, it would have to work in such a way that when the first date of an event is already done, the query would now orderby the second closest date after $today.

    I do understand how to order a query by a specific meta_key, but I’m not sure how to filter this meta just to use the next closest date subfield after today.

    Thank you!

  • You cannot do this because a every repeater sub field has a different meta key.

    This might be one way to work around this problem

  • Great, I think this will do well.

    Thank you very much, John!

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

You must be logged in to reply to this topic.