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


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.

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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Josh 5 months, 1 week ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!