Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    yes, here’s another thread which may help you with this – https://www.ads-software.com/support/topic/events-manager-using-post-categories?replies=8

    Thread Starter ewebber

    (@ewebber)

    Thanks, I have added the categories into the events post type and I am showing them alongside the main posts which is great. Now I’m looking at editing the form so that people can pick those categories from the front end.

    I am in the /wp-content/themes/yourtheme/plugins/events-manager/forms/event/categories-public.php file, what should I change to pull the default categories instead of the EM ones?

    Hiya,

    Take a look at the codex which will give you the info you need to extract the categories: https://codex.www.ads-software.com/Function_Reference/get_categories

    Thanks

    Thread Starter ewebber

    (@ewebber)

    @angelo_nwl can you let me know if I’m in the right file, or should I be looking at a different one.
    Thanks

    Plugin Support angelo_nwl

    (@angelo_nwl)

    yes, you are in the right file and you might need to call post categories quite the same on how we call event categories.

    Thread Starter ewebber

    (@ewebber)

    @anglo_nwl thanks, I now have it showing the categories on the event submit form, but it’s not passing them through the the created event

    so far I have

    <?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 = get_categories(array('orderby'=>'name','hide_empty'=>0));
    ?>
    <?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; ?>

    Is it possible to make this change in this file and can you help me understand what I should change, I’d really appreciate some pointers – thanks

    You also need to hook into the saving process. Your fields will be passed through when the form is submitted, but you need to actually process them.

    You might be able to use the save_post filter for this.

    Thanks

    Thread Starter ewebber

    (@ewebber)

    I’ve tried to play around with the file, but I’m not getting anywhere, am I looking in the right place to be able to hook into the saving process, or should I be doing that elsewhere?
    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Using post categories’ is closed to new replies.