• Resolved Palijn

    (@palijn)


    Hello,
    In the events list it is possible to filter events by categories, which is fine.
    Actually, I would love to see the category of each event in the list (as a new column); it would greatly help in order to select which category I want to filter, based on an event from the list of displayed events.
    Thanks for your support!
    Regards,
    Thierry

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

    (@angelo_nwl)

    you can try option under Events > Settings > Formatting > Events > Default event list format then add placeholder #_EVENTCATEGORIES

    Thread Starter Palijn

    (@palijn)

    Sorry I was unclear. I am talking of the event list in the admin page from the wp-admin section. I suppose the formatting you suggest only applies to the front-end ?

    Plugin Support angelo_nwl

    (@angelo_nwl)

    sorry but Im afraid that this is not yet possible at the moment.

    Thread Starter Palijn

    (@palijn)

    Thank you @angelo_nwl .
    Is it a feature you will consider developing in a future release?

    What I did, is add the normal WordPress categories to be used in Events Manager. That will automatically show the categories in the Events Admin Table, like you want. They can also be used in the events list calendar at the front end:

    function stonehenge_use_blog_categories() {
    	$supported_array = (EM_MS_GLOBAL && !is_main_site()) ? array() : array(EM_POST_TYPE_EVENT,'event-recurring');
    	register_taxonomy_for_object_type('category',EM_POST_TYPE_EVENT);
    	register_taxonomy_for_object_type('category','event-recurring');
    
    	// Uncomment next line to also use for EM Locations.
    	//register_taxonomy_for_object_type('category',EM_POST_TYPE_LOCATION);
    }
    add_action('init', 'stonehenge_use_blog_categories', 100);

    EDIT:

    Here you go! ?? If you paste these two functions in your functions.php you should get the EM Categories in a new column in the Events List Page.

    function stonehenge_create_tax_column_header($column) {
        $column['event-categories'] = 'EM Category'; //Rename 'EM Category' to anything you like.
        return $column;
    }
    add_filter('manage_event_posts_columns', 'stonehenge_create_tax_column_header');
    
    function stonehenge_create_tax_column_content( $column, $post_id ) {
        if( 'event-categories' === $column ) {
            $post_type = get_post_type($post_id);
            $terms = get_the_terms($post_id, $column);
            if( !empty($terms) ) {
                foreach ( $terms as $term ) {
                    $post_terms[] = "<a href='edit.php?post_type={$post_type}&{$taxonomy}={$term->slug}'> " .esc_html(sanitize_term_field('name', $term->name, $term->term_id, $taxonomy, 'edit')) . "</a>";
                }
                echo implode(', ', $post_terms);
            }
        }
    }
    add_action( 'manage_event_posts_custom_column', 'stonehenge_create_tax_column_content', 10, 2);

    NOTE: This does not work on WP MultiSite.

    Thread Starter Palijn

    (@palijn)

    Yay!
    Patrick @duisterdenhaag you’re fantastic !

    Thank you. Thank you. Signed t-shirts can be bought in the souvenir shop! LOL.

    Just glad to help ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Event list : display event category in the list ?’ is closed to new replies.