custom meta query by venue and date

Home Forums Calendar Products Events Calendar PRO custom meta query by venue and date

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1369527
    Angel Cano Ydanez
    Participant

    Hi,
    I have the following code inside a custom post type loop:

    						$args = array(
    								 'posts_per_page' => 10,
    									'meta_query' => array(
    										'relation' => 'AND',
    										array(
    											'key'     => '_EventVenueID',
    											'value'   => $venue_id,
    										),
    										array(
    											'key'     => '_EventEndDate',
    											'value'   => date("Y-m-d H:i:s"),
    											'compare' => '>='
    										)
    									),
    								);
    
    						$events = tribe_get_events($args);

    The query i want to do is: Select for a specific venue id all events which end date is equal or later than current date & time.

    Is there any other shorter way – or more accurate / optimized way – to do that query? or am i in the right way?

    Also: and what about the recurrent events? Will they show up in this query?

    Thanks in advance!

    #1370285
    Cliff
    Member

    Hi, Angel. Yes, it’s easier than that because of using tribe_get_events().

    Please reference https://theeventscalendar.com/knowledgebase/using-tribe_get_events/ and https://github.com/moderntribe/the-events-calendar/blob/4.6.2/src/functions/template-tags/general.php#L183-L219

    Example:

    $args = array( '<span class="pl-c">venue' => 7 </span>);
    
    $events = tribe_get_events($args);

    Please let me know if you have any follow-up questions on this topic.

    #1386369
    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 meta query by venue and date’ is closed to new replies.