This will spit out a shortcode for Event Espresso for a Event List with multiple categories the user chooses.
- Create some event espresso calendar categories.
- Create an Advanced Custom Field Group with 2 Fields
- “Show Events?” (radio button, “No” “Yes” – default no)
- “Categories”: (checkboxes with your categories as choices)
- Then create a place in your template to show them. Do this with the following code.
// do we show events
$showevents = get_field('show_events');
// Show event list if "yes"
if($showevents == 'Yes') :
// put all values into a variable
$allcategories = implode(', ', get_field('categories'));
// echo out results
echo do_shortcode( '[EVENT_LIST event_category_id=' . $allcategories . ']');
endif;