Getting list of venue ids which have events that match certain event category?
-
I’m using the pro version of the plugin and I’m currently modifying the shortcode for the eo_venue_map so that I can have an extra parameter tours=”formal” or tours=”informal”.
I have made 2 categories with their respective slugs: formal-tours and informal-tours
What is the best way to grab a list of venues that have events which match a certain event category?
For instance, currently it gets a list of venues in B.C, and other provinces with a switch case
$region = $args[‘region’];
switch ($region) {
case “BC”:$venue_querybc = array(
array(
‘key’ => ‘_state’,
‘value’ => ‘British Columbia’
)
);$events_from_venue = new WP_Query( array(
‘post_type’ => ‘event’,
‘venue_query’ => $venue_querybc,
‘event_start_after’ => ‘today’
));$venue_ids = eo_get_venues( array( ‘meta_query’ => $venue_querybc ) );
$venue_slug_or_id = array_map(‘intval’,wp_list_pluck($venue_ids,’term_id’));
$mapflag = 1;
break;case “AB”:
break;
}Now as you can see, I currently grabbed a list of events $events_from_venue and now I was thinking to do a foreach and create a new arraylist of events with the matching categories, and then somehow use a function to get the venue ids of those matching events so I could then display those on the map.
You can assume that there will be one upcoming event per venue. If there is more than one upcoming event, but one of them doesn’t match the category, then it can just ignore it.
I’m sure there is an easier way of doing this than what i’m thinking of.
Thanks.
https://www.ads-software.com/extend/plugins/event-organiser/
- The topic ‘Getting list of venue ids which have events that match certain event category?’ is closed to new replies.