ACF Checkboxes – put all values into a shortcode

This will spit out a shortcode for Event Espresso for a Event List with multiple categories the user chooses.

  1. Create some event espresso calendar categories.
  2. Create an Advanced Custom Field Group with 2 Fields
    1. “Show Events?” (radio button, “No” “Yes” – default no)
    2. “Categories”: (checkboxes with your categories as choices)
  3. 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;