Event category as a dropdown rather than checkboxes

WordPress Event Management, Calendars & Registration Forums Frontend Submissions Event category as a dropdown rather than checkboxes

This topic contains 2 replies, has 2 voices, and was last updated by  Brian Reeves 7 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #27226

    Is it currently possible to have the Event Category field display as a single choice drop down rather than a multiple choice checkbox list?

    Brian Reeves
    #27288

    If you copy event-organiser-fes/templates/elements/eo-event-form-event-category.php to your theme and replace

    eo_event_category_checklist(array(
        'name'          => $this->element->get_field_name( 'terms' ),
        'selected_cats' => $this->element->get_value( 'terms' ),
        'class'         => $this->element->get_class(),
        'exclude'       => $this->element->get( 'exclude' ),
    ));
    

    with

    wp_dropdown_categories(array(
        'taxonomy'        => 'event-category',
        'hierarchical'    => 1,
        'hide_empty'      => false,
        'show_option_none' => 'None',
        'name'             => $this->element->get_field_name( 'terms' ) . '[]',
        'selected'         => $this->element->get_value( 'terms' ),
        'class'            => $this->element->get_class(),
        'exclude'          => $this->element->get( 'exclude' ),
    ));
    

    that should work.

    Stephen Harris
    #27303

    Thanks.

    Brian Reeves
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.