Hi- I’m trying to add event category names to display in the event lists on my site. I’m editing content-espresso_events-header.php to add the category directly following the event title. I have tried various methods at this point, and either I am returned nothing, or ‘array’. The code below returns ‘array’. Where am I going wrong? Thanks.
To clarify, line 11 is the code in question… <a class="" href="<?php the_permalink(); ?>"><?php the_title(); ?><br /><?php $category = get_the_category(); echo $category; ?></a>
In the code in question, you’re using the get_the_category() function. That function only returns results from the default “category” taxonomy. Event Espresso event categories are a custom taxonomy. You can use get_the_terms() for custom taxonomies. See also:
The support post ‘Adding category to event lists in EE4’ 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.