Last active
October 17, 2017 21:09
-
-
Save jentheo/1be5502370030a3d52061e3e751a5f4c 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
Hi,
Thanks for your code !
But i would like to add the category.
Do you have a issue ?
Thanks of lot.
See you bye
Here is my code :
`$events = tribe_get_events( array(
)));
$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
) );
if( $upcoming->have_posts()) :
while( $upcoming->have_posts() ): $upcoming->the_post();
echo '
' . $upcoming->post->post_title . '
';endwhile;
wp_reset_postdata();
else :
echo 'No posts found';
endif;
?>
`