Home › Forums › Calendar Products › Events Calendar PRO › Custom query – ignore duplicates
- This topic has 3 replies, 4 voices, and was last updated 7 years, 8 months ago by nysci.
-
AuthorPosts
-
August 9, 2016 at 1:23 pm #1149679nysciParticipant
I’m creating a module for the “single event view” screen. This module needs to retrieve a list of three events that are related to the current event being viewed. I’m telling it to look for events that share an tribe_events_cat with the current event. At the moment, it’s pulling in three events from a recurring series. I would like it to pull in only the next-upcoming event in the series, and then pull in two other events. Below is my current query. How can I modify it so that duplicate events don’t get returned?
$items = tribe_get_events(array( 'posts_per_page' => 3, 'eventDisplay' => 'upcoming', 'tax_query' => array( 'relation' => 'OR', array( 'taxonomy' => 'tribe_events_cat', 'field' => 'term_id', 'terms' => $event_cat_ids, 'operator' => 'IN' ), array( 'taxonomy' => 'post_tag', 'field' => 'term_id', 'terms' => $event_tag_ids, 'operator' => 'IN' ), ), ));
August 10, 2016 at 8:49 am #1150002JoshParticipantHey Dan,
Thanks for reaching out to us!
There are a couple of options to pursue here. Recurring events have a main instance and each additional instance gets treated as a child page of that main instance. So, if you wanted to modify the query to pull just one main recurring event, you could ensure that “post_parent” was 0 in your WP Query args above.
Let me know if this helps.
Thanks!
September 1, 2016 at 9:35 am #1158817Support DroidKeymasterHey 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 ‘Custom query – ignore duplicates’ is closed to new replies.