• Resolved grafica.villcom

    (@graficavillcom)


    Hi,

    I’d like to change a few things inside the frontend submission form. For example I wish I could change the way categories are display. How can I change the multiple selection for categories to checkboxes? It would be more simple for users. I think I have to code something inside categories-public.php instead of this:

    <!-- START Categories -->
    	<label for="event_categories[]"><?php _e ( 'Category:', 'events-manager'); ?></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 -->

    Can anyone help me? Thank you!

    https://www.ads-software.com/plugins/events-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    Assuming you want to keep the category list dynamic, you’d need to create your own version of $walker which used checkboxes instead of a select box.

    Hi grafica.villcom,

    try this:

    <!-- START Categories -->
    
    	<label for="event_categories[]"><?php _e ( 'Category:', 'events-manager'); ?></label>
    
    	<div class="checkCats">
    
    	<?php
    
    	$selected = $EM_Event->get_categories()->get_ids();
    
    	$walker = new EM_Walker_Category();
    
    	$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);
    
    	?></div>
    
    	<!-- END Categories -->

    the additional div class “checkCats” is for you may add CSS to the list of check boxes.
    for me it works though it’s only a straight list …

    it actual uses another walker as caiman_nwl proposed . It’s a noter walker witch exists allready in EM -> classes -> em-category-taxonomy.php

    If you want to control the output ( i.e. table view … ) more exactly you might copy the class EM_Walker_Category (line 223-293), give it another name, edit it and use this new one in the code above.

    best regards
    Micky

    I have used this code and it is working very well for me. Thanks!

    Would you know how to amend this to work with a Custom Taxonomy by any chance? I have created Location Categories using Pods but Im unable to display the new categories, only the Event categories.

    My Original post can be found here: https://www.ads-software.com/support/topic/add-location-category-in-front-end/

    Any assistance with this would be greatly appreciated!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Frontend submission form – categories as checkboxes’ is closed to new replies.