Events Manager
[resolved] Add Taxonomies Dropdown Menu to Front End Event Editor (5 posts)

  1. bentonwalker
    Posted 3 years ago #

    I'm trying to implement the following taxonomy (at very bottom of this post) into the event-editor.php file. I want my users to be able to select and add artists from a drop down menu on the front end editor. I can add the artists from the back end editor but have had no success from the front end. I'm mostly a front end developer so I don't mess with PHP that much. Here's what I have so far - which shows a drop down menu of different artists but fails to add or input them into the system when a user creates an event.

    I duplicated categories-public.php and saved it as taxonomies-public.php with this code:

    global $EM_Event;
    /* @var $EM_Event EM_Event */
    $categories = EM_Categories::get(array('orderby'=>'name','hide_empty'=>0));
    <?php if( count($categories) > 0 ): ?>
    <div class="event-categories">
    	<!-- START Categories -->
    	<label for="event_categories[]"><?php _e ( 'Artists:', 'dbem' ); ?></label>
    	<select name="event_categories[]" >
    	$taxonomies = array('artists');
    		$args = array('orderby'=>'count','hide_empty'=>true);
    		echo get_terms_dropdown($taxonomies, 0, $args);
    	<!-- END Categories -->
    <?php endif; ?>

    CUSTOM TAXONOMY CODE - I've put this into its own plugin file.

    // custom Artist taxonomy for events
    add_action( 'init', 'register_my_taxonomies', 0 );
    function register_my_taxonomies() {
    $labels = array(
        'name'                          => 'artists',
        'singular_name'                 => 'artist',
        'search_items'                  => 'Search Artists',
        'popular_items'                 => 'Popular Artists',
        'all_items'                     => 'All Artists',
        'parent_item'                   => 'Parent Artist',
        'edit_item'                     => 'Edit Artist',
        'update_item'                   => 'Update Artist',
        'add_new_item'                  => 'Add New Artist',
        'new_item_name'                 => 'New Artist',
        'separate_items_with_commas'    => 'Separate Artists with commas',
        'add_or_remove_items'           => 'Add or remove Artists',
        'choose_from_most_used'         => 'Choose from most used Artists'
    $args = array(
        'label'                         => 'Artists',
        'labels'                        => $labels,
        'public'                        => true,
        'hierarchical'                  => true,
        'show_ui'                       => true,
        'show_in_nav_menus'             => true,
        'args'                          => array( 'orderby' => 'term_order' ),
        'rewrite'                       => array( 'slug' => 'events/artists', 'with_front' => false ),
        'query_var'                     => true
    register_taxonomy( 'artists', EM_POST_TYPE_EVENT, $args );
    // custom taxonomy search and display
    add_action('em_template_events_search_form_ddm', 'artists_search_form');
    function artists_search_form(){
    	$artists = (is_array(get_option('artists'))) ? get_option('artists'):array();
    	<!-- START artists Search -->
    	<select name="artist" id="artist_search">
    		<option value="" selected="selected">Artists</option>
    		$taxonomies = array('artists');
    		$args = array('orderby'=>'count','hide_empty'=>true);
    		echo get_terms_dropdown($taxonomies, $args);
    	<!-- END artists Search -->
    function my_em_artists_event_load($EM_Event){
    	global $wpdb;
    	$EM_Event->artists = $wpdb->get_col("SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE object_id='{$EM_Event->post_id}'", 0	);
    // And make the search attributes for the shortcode
    function my_em_artists_get_default_search($searches, $array){
    	if( !empty($array['artist']) ){
    		$searches['artist'] = $array['artist'];
    	return $searches;
    function my_em_artists_events_get($events, $args){
    	if( !empty($args['artist'])  ){
    		foreach($events as $event_key => $EM_Event){
    			if( !in_array($args['artist'],$EM_Event->artists) ){
    	return $events;
    function get_terms_dropdown($taxonomies, $args){
    	$myterms = get_terms($taxonomies, $args);
    	foreach($myterms as $term){
    		$root_url = get_bloginfo('url');
    		$term_name =$term->name;
    		$value = $term->term_id;
    		$output .="<option value='".$value."'>".$term_name."</option>";
    return $output;

    Any help would be greatly appreciated. Thanks!!


  2. agelonwl
    Posted 3 years ago #


    actually, I haven't tried this yet but will do and will update you again once I found something.

  3. bentonwalker
    Posted 3 years ago #

    Thanks, please let me know what you come up with.

  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    from the looks of it you don't have any hooks to do the saving.

    see this tutorial for some guidance:


    also, you would want to see how we save categories to events in classes/em-categories.php around this line:

    wp_set_object_terms($this->post_id, $term_slugs, EM_TAXONOMY_CATEGORY);

    also, I notice in your first snippet you do a check for categories and only output content if normal event-categories are > 0 , when you probably want to check artists.

  5. Arnaud sprimont
    Posted 2 years ago #

    hello bentonwalker,

    Did you find a solution for this tax. dropdown?

    I have the same problem and still no solution.

    Thank a lot
    see you

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic