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.

You must be logged in to reply to this support post. Sign In or Register for an Account

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: publish

Updated by  Josh 1 week, 3 days ago ago

Topic Tags

Notifications

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