Support

Home Forums Event Espresso Premium EE4 display event category in loop

EE4 display event category in loop

Posted: December 12, 2017 at 5:44 pm


salda

December 12, 2017 at 5:44 pm

Hi there,

Hopefully someone can help. I’ve been looking for a way to display the event category on the event list page (yes, I’m creating a custom archive template). I keep seeing this code which should do what I want:

`do_shortcode(‘[CATEGORY_NAME event_id=”‘.$event_id.'”]’)
I’m substituting event_id for post->ID since I’m within a loop but it’s just returning the text of the shortcode, eg: [CATEGORY_NAME EVENT_ID=”310″] actually appears on screen in the place where I want the category name to display.
The ID is correct – but the shortcode isn’t working. I’m assuming this is a difference between EE3 and 4.

What’s the v4 equivalent please?

Cheers,
Min


Josh

  • Support Staff

December 12, 2017 at 6:09 pm

Hi Min,

EE4 doesn’t actually use shortcodes to show this type of data because EE4 events are custom post types. So you can use native WordPress functions instead. I can point you to these references:

https://developer.wordpress.org/reference/functions/get_the_terms/
https://developer.wordpress.org/reference/functions/get_the_term_list/

The $taxonomy registered for EE event categories is:
espresso_event_categories


salda

December 12, 2017 at 6:16 pm

Perfect – thank you. I’ve gotten it working using get_the_terms 🙂

The support post ‘EE4 display event category in loop’ 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