Issue with tribe_get_events

Home Forums Calendar Products Events Calendar PRO Issue with tribe_get_events

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1370332
    kristin
    Participant

    [moved by admin]

    #1370333
    kristin
    Participant

    Hello,

    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!

    #1371331
    Andras
    Keymaster

    Hi 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,
    Andras

    #1371332
    Andras
    Keymaster

    This reply is private.

    #1371503
    kristin
    Participant

    Hi 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?

    #1372003
    Andras
    Keymaster

    Just 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.

    #1372423
    kristin
    Participant

    Sorry, 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.

    #1372711
    Andras
    Keymaster

    Sorry to hear that didn’t work.

    Please give me some time while I ask around if anyone can help with this.

    Thanks,
    Andras

    #1390052
    Support Droid
    Keymaster

    Hey 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

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Issue with tribe_get_events’ is closed to new replies.