Display Categories in Dropdown instead of Multiselect
-
How do I display the categories on the “Submit Event” page in a dropdown instead of a multiselect? I want users to only be able to give their events 1 category.
I found this code in templates > forms > categories-public.php but I don’t know how to make them display in a dropdown:
<?php if( count($categories) > 0 ): ?>
<div class=”event-categories”>
<!– START Categories –>
<label for=”event_categories[]”><?php _e ( ‘Category:’, ‘dbem’ ); ?></label>
<select name=”event_categories[]” multiple size=”10″>
<?php
$selected = $EM_Event->get_categories()->get_ids();
$walker = new EM_Walker_CategoryMultiselect();
$args_em = array( ‘hide_empty’ => 0, ‘name’ => ‘event_categories[]’, ‘hierarchical’ => true, ‘id’ => EM_TAXONOMY_CATEGORY, ‘taxonomy’ => EM_TAXONOMY_CATEGORY, ‘selected’ => $selected, ‘walker’=> $walker);
echo walk_category_dropdown_tree($categories, 0, $args_em);
?></select>
<!– END Categories –>
</div>
<?php endif; ?>
- The topic ‘Display Categories in Dropdown instead of Multiselect’ is closed to new replies.