Home › Forums › Calendar Products › Events Calendar PRO › Issue with tribe_get_events
- This topic has 9 replies, 2 voices, and was last updated 8 years, 5 months ago by
kristin.
-
AuthorPosts
-
October 27, 2017 at 12:01 pm #1370332
kristin
Participant[moved by admin]
October 27, 2017 at 12:06 pm #1370333kristin
ParticipantHello,
I have a custom call to tribe_get_events which isn’t working as I’d expect. I want to just grab the first upcoming event of a specific event category, which I’ve setup as such
$events_genre = tribe_get_events( array( 'posts_per_page' => 1, 'start_date' => date( 'Y-m-d' ), 'post__not_in' => array( get_the_ID() ), 'eventDisplay' => 'list', 'tax_query' => array( array( 'taxonomy' => 'class-genre', 'field' => 'slug', 'terms' => $post_genre_slug[0]->slug, ) ), ) );However, the resulting event I get back is an event which started in September and Ends in November. I’m realizing that maybe because this event is still ongoing that maybe the call to tribe_get_events isn’t returning what I’d expect? Ideally I’d like to get the next event of this category that HASN’T started yet. Thanks!
October 30, 2017 at 6:09 am #1371331Andras
KeymasterHi Kristin,
Thanks for reaching out!
Is that a recurring event that you get? If yes, then you can try also filtering out ‘post_parent’.
All the single instance events and the first occurrence of a recurring event have a ‘post_parent’ value of 0 (that’s in the wp_posts table). The recurrences will have there the ID of the parent event.
Does this help? Let me know.
Cheers,
AndrasOctober 30, 2017 at 6:10 am #1371332Andras
KeymasterThis reply is private.
October 30, 2017 at 9:46 am #1371503kristin
ParticipantHi András,
Thanks for the reply. No, this isn’t a recurring event. It’s simply an event that spans for multiple months and it still considered ‘In Progress’, I suppose you could say. I’m just curious if there’s a way to filter out events like that?
October 31, 2017 at 4:27 am #1372003Andras
KeymasterJust an idea for now, if you want to filter out multi day events, then you could add the following line:
'end_date' = 'start_date',Does this help?
A.
October 31, 2017 at 12:27 pm #1372423kristin
ParticipantSorry, is this supposed to be an argument for get_events?
Like so?
'end_date' => 'start_date',I gave that a try and still no luck unfortunately.
November 1, 2017 at 2:56 am #1372711Andras
KeymasterSorry to hear that didn’t work.
Please give me some time while I ask around if anyone can help with this.
Thanks,
AndrasNovember 23, 2017 at 8:36 am #1390052Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Issue with tribe_get_events’ is closed to new replies.
