Support

Home Forums Event Espresso Premium How to add categories name on default archive page

How to add categories name on default archive page

Posted: May 14, 2018 at 6:03 am

Viewing 1 reply thread


nibbhaya

May 14, 2018 at 6:03 am

Hi, I want to add categories name on event archive page, but not sure how will I do that; http://vnpano.com/ttctics/events/

Is it possible to add categories name on default archive page?
Thank You


nibbhaya

May 14, 2018 at 6:03 am

I want to add categories name on event archive page; http://vnpano.com/ttctics/events/


Josh

  • Support Staff

May 14, 2018 at 4:03 pm

Hi there,

It looks like you’re using the X theme, in which case you can add this code to your site:

function my_display_ee_event_categories_x_theme() {
$terms = get_the_terms( get_the_ID(), 'espresso_event_categories' );
                         
if ( $terms && ! is_wp_error( $terms ) ) : 
 
    $event_categories = array();
 
    foreach ( $terms as $term ) {
        $event_categories[] = $term->name;
    }
                         
    $evt_cat_names = join( ", ", $event_categories );
    ?>
 
    <p class="event-categories">
        <?php printf( 'Categories: <span>%s</span>', esc_html( $evt_cat_names ) ); ?>
    </p>
<?php endif; 
}
add_action('x_before_view_global__content', 'my_display_ee_event_categories_x_theme');

You can add the above to a functions plugin or into your child theme’s functions.php file.

Viewing 1 reply thread

The support post ‘How to add categories name on default archive page’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso