• Hello!

    Thanks for this wonderful plugin! As our users will use the “Submit event” on the front end quite often, we customized the layout of the page in order to simplify it. We used a template (event-editor.php), which is working fine. Now we wanted to modify the dropdown menu of catgories. We wanted to have checkboxes instead – the same layout like in the back end, if a user is creating an event and chossing several categories.

    We managed to find the right location to modify it: categories-public.php. But now we are stuck. Do you have any hint which function we could use to get an unordered list of categories with checkboxes on the front end?

    Thank you in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello,

    You could modify the template file: categories-public.php which is located under events-manager/templates/forms/event

    What you could do is change the select list to a ul or ol and add the necessary form tags. The variable for taxonomy terms that you would need to loop is also on the file.

    Thread Starter vaid000

    (@vaid000)

    Hello, thank you for your reply!

    We’ll try this and report here, if this is working…
    Maybe we’ll also have a closer look at the back end in order to get an idea how the event category checkboxes are generated.

    I modified categories-public.php this way and it works

    <?php
    /*
     * This file is called by templates/forms/location-editor.php to display fields for uploading images on your event form on your website. This does not affect the admin featured image section.
    * You can override this file by copying it to /wp-content/themes/yourtheme/plugins/events-manager/forms/event/ and editing it there.
    */
    global $EM_Event;
    /* @var $EM_Event EM_Event */ 
    $categories = EM_Categories::get(array('orderby'=>'name','hide_empty'=>0));
    ?>
    
    <div id="event-categories-all" class="tabs-panel">
    			<input type='hidden' name='tax_input[event-categories][]' value='0' />	
    		<?php if( count($categories) > 0 ): ?>
    			<p class="ms-global-categories">
    			 <?php $selected = $EM_Event->get_categories()->get_ids(); ?>
    			 <?php $walker = new EM_Walker_Category(); ?>
    			 <?php $args_em = array( 'hide_empty' => 0, 'name' => 'event_categories[]', 'hierarchical' => true, 'id' => EM_TAXONOMY_CATEGORY, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $selected, 'walker'=> $walker); ?>
    			 <?php echo walk_category_dropdown_tree($categories, 0, $args_em); ?>
    			</p>
    		<?php endif; ?>
    </div>
    Thread Starter vaid000

    (@vaid000)

    Thank you leleuf! Your provided code is working well. We now have a vertically aligned list of checkboxes for categories selection.

    What I tried to achieve now is inserting a wrapping <li> tag and a wrapping <label> element for styling and aligning the checkboxes with css. This would be similar to the styling in the wordpress admin area: all checkboxes for categoires selection seem to be formatted like this:

    <ul id=”event-categorieschecklist” class=”categorychecklist”>
    <li id=”event-categories-19″ class=”popular-category”>
    <label class=”…”>
    <input value=”19″ name=”…” id=”in-event-categories-19″ type=”checkbox”> labeltext
    </label>

    Sorry, I’m new to PHP an not quite sure how to generate the checkboxes as unordered list. I tried modifying your code in categories-public.php but until now with no success 🙁

    Any ideas on this? Thank you in advance!

    Plugin Support angelo_nwl

    (@angelo_nwl)

    sorry but at the moment we are quite limited with regards to custom coding as per the support policy – http://eventsmanagerpro.com/support-policy/

    Thread Starter vaid000

    (@vaid000)

    Thanks for your answer, Angelo. After some work and digging into the code, we managed to customize the submit form: categories are now listed as checkboxes. We are kind of close to a solution and will post it back here if it is working correctly.

    I really appreciate the Events Manager Plugin and all the support I’m getting in this forum. And of course there is only limited support for custom coding in the free version. Is there any support for custom coding in the paid version? Just asking for any future requests / problems.

    Cheers!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Checkboxes for categories on submit event page’ is closed to new replies.