Posted: August 20, 2015 at 5:38 am
|
Hi! So I’ve been working on getting the earliest upcoming datetime for an event do show as it’s date in the events archive listing. There does not seem to be any functions that actually does this strangely enough.. Anyway. I solved it with this code:
However now I find that the query that fetches the events does not honor this order. The event which I’ve tested has its earliest upcoming datetime 26th august and latest upcoming datetime 29th september. That would mean the event should appear in august but instead it’s showing in september (but my date say august). Any thoughts on this? Maybe a missed bug? |
Can you try something like this instead? $datetimes = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time( $post->ID, false, false, 1 ); $datetime = end( $datetimes ); $display_date = date_i18n( 'Y-m-d' . ' ' . 'H:i:s', strtotime( $datetime->start_date_and_time('Y-m-d', 'H:i:s') ) ); |
|
|
Hi Josh, Wouldn’t that just return the last datetime as well? What if I have one between the one that’s passed and the last datetime.. Also the issue about the archive query remains 🙂 |
No it wouldn’t, because the last parameter passed to the get_datetimes_for_event_ordered_by_start_time() method sets the limit, and the limit is set to 1 in the example code I shared with you. If you want to open up a pull request on github regarding the archive query the dev team can look into it. |
|
The support post ‘Events archive not honouring earliest upcoming datetime’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.