-
-
Save polack45/f10fc9c06265f0adf8e1d318a971aabf to your computer and use it in GitHub Desktop.
Query only events in Frankfurt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Retrieve venues that match query criteria | |
$args = array( | |
'nopaging' => true, | |
'post_type'=>'tribe_venue', | |
//Only query venues in Frankfurt | |
'meta_query' => array( | |
array( | |
'key' => '_VenueCity', | |
'value' => array( 'Frankfurt'), | |
'compare' => 'IN', | |
) | |
) | |
); | |
$city_venue = get_posts( $args ); | |
$venue_ids = wp_list_pluck( $city_venue, 'ID' ); | |
wp_reset_postdata(); | |
$upcoming = new WP_Query( array( | |
'post_type' => Tribe__Events__Main::POSTTYPE, | |
'meta_query' => array( | |
array( | |
'key' => '_EventVenueID', | |
'value' => $venue_ids, | |
'compare' => 'IN', | |
) | |
), | |
'paged' => $paged | |
) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment