Support

Home Forums Event Espresso Premium Categories not showing in single event posts

Categories not showing in single event posts

Posted: August 1, 2015 at 11:25 am


Nick

August 1, 2015 at 11:25 am

Hi,

Am I right in thinking that Event Espresso 4 categories for events should show under in the single event pages, handled by this code in single.php in my theme:

<p class="date">
<?php printf( __( '%1$s <span>in %2$s</span>', 'buddypress' ), get_the_date(), get_the_category_list( ', ' ) ); ?>
</p>

As I am not seeing any categories here.

Nick


Dean

August 3, 2015 at 4:46 am

Hi Nick,

Event Categories are custom taxonomies, and when viewing them (e.g. /event-category/my-first-category/ ) the theme will generally use the archive.php file or index.php if the archive.php is not available.


Nick

August 3, 2015 at 4:08 pm

Hi Dean,

Thanks for your response. I am not clear from your response what I need to do to get this working. I am trying to show Event Espresso Categories on the main event page where multiple events are listed, and also on single event pages, and I am wondering whether get_the_category_list( ', ' ) should return these, because at the moment I am not seeing any categories on my pages, even though they are assigned to events.


Tony

  • Support Staff

August 4, 2015 at 5:17 am

Hi Nick,

Event Espresso categories are actually a custom taxonomy.

get_the_category_list( ', ' )

Will only work with the default WP ‘category’ taxonomy, so to pull in the EE categories you’ll need to do something like this:

echo get_the_term_list( $post->id, 'espresso_event_categories', 'Categories: ', ', ', '' );

Which outputs a list of EE categories like this – http://take.ms/gfKO3
Each linking to that category page.

Is that what you are looking for?


Nick

August 4, 2015 at 2:47 pm

Once again your code is spot on Tony.

Thanks very much.

Nick

The support post ‘Categories not showing in single event posts’ 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