Home › Forums › Calendar Products › Events Calendar PRO › Get next future event in a recurring series, from any passed instance view
- This topic has 5 replies, 4 voices, and was last updated 7 years, 9 months ago by Agustín.
-
AuthorPosts
-
August 3, 2016 at 7:20 am #1147013AgustínParticipant
I’m integrating the pro version with a theme we made from scratch for center that offers different courses and workshops for children.
In the single-event.php view of a given recurring course, when the event has passed, I want to show a box saying “hey, make a reservation for the next class which is Friday the 13th” or whatever.
So I tried to use tribe_get_upcoming_recurring_event_id_from_url() to get the next event info, but it returns the ID of the first event in the series… is this the intended behavior, am I doing something wrong? both?
Any suggestions on how to do something like this?
Thanks.
August 4, 2016 at 8:04 am #1147551GeoffMemberHey Agustin and welcome to the forums!
This is a great question. Yes, that is the expected behavior for the function and I’m afraid that we do not have a decent function that will grab the next upcoming event instance in the series.
Instead, I think making a query for the event will be the better way to go. Here’s another thread where someone was able to pull that off using the tribe_get_events() function to build the query.
I’ll continue looking for specific examples, but will this help get you started in the meantime? Please let me know. 🙂
Cheers!
GeoffAugust 4, 2016 at 8:37 am #1147560BrookParticipantHowdy Agustín,
We just wrote a short function that will do this for you:
https://gist.github.com/elimn/d7bc39b59e4f94946a2bb9faad6ce382
Pass it the post ID of the event that you are trying to get the next upcoming recurrence for, and it will return the WP_Post for that recurrence if one exists. That do what you wanted?
Cheers!
– Brook
August 4, 2016 at 11:36 am #1147754AgustínParticipantHey, Geoff, thank you for the pointers, in fact I eventually discover tribe_get_events() and made it work. I was gonna post my the solution here at the end of the day but that’s still a few hours away 🙂
Brook, that’s great! I’ll switch to this solutions as soon as I can.
Cheers!
August 4, 2016 at 11:39 am #1147757GeoffMemberHeck yeah and thanks for following up, Agustin! Glad this helps — I’ll go ahead and close this thread but please feel free to let us know if any other questions pop up and we’d be happy to help. 🙂
Cheers!
Geoff -
AuthorPosts
- The topic ‘Get next future event in a recurring series, from any passed instance view’ is closed to new replies.