Hello,
With the help of the forum I was able to make my categories in add event submission form show up in a drop down opposed to the check boxes… however, this drop down does not show any of my Categories only sub categories, which makes it confusing because nothing is organized, and there is duplicate subcategories within all categories…
for instance
Games
– cards
– board games
– other
sports
– hockey
-golf
-other
other shows up in the list twice, how can I organize it so that in my drop down, it will show the main category and sub categories below that category and so on for each main category:
Here is the code i am using:
<?php
$event_cat_ids = array();
if ( $event ) {
$event_cats = wp_get_object_terms( $event->ID, TribeEvents::TAXONOMY );
foreach ( $event_cats as $event_cat ) {
$event_cat_ids[] = $event_cat->term_id;
}
} else {
$event_cats = array();
}
$args = array(
‘hide_empty’ => false,
‘orderby’ => ‘name’,
‘order’ => ‘ASC’,
‘exclude’ => $event_cat_ids,
);
$cats = get_terms( TribeEvents::TAXONOMY, $args );
$cats = array_merge( $event_cats, $cats );
$cats = apply_filters( ‘tribe_community_events_event_categories’, $cats );
echo ‘<select name=”tax_input[tribe_events_cat][]”>’;
echo ‘<option> Select a category </option>’;
foreach ($cats as $cat)
echo ‘<option value=”‘.esc_attr($cat->term_id).'”>’.esc_html($cat->name).'</option>’;
echo ‘</select>’;
?>