Custom query – ignore duplicates

Home Forums Calendar Products Events Calendar PRO Custom query – ignore duplicates

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1149679
    nysci
    Participant

    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'
    			),
    		),
    	));
    
    #1150002
    Josh
    Participant

    Hey 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!

    #1158817
    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 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Custom query – ignore duplicates’ is closed to new replies.