Support

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

Reply To: How to add categories name on default archive page

Author Replies
Josh # Posted on 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.

Do NOT follow this link or you will be banned from the site!