Support

Home Forums Event Espresso Premium I can't display a list of all categories on my event listing page

I can't display a list of all categories on my event listing page

Posted: January 10, 2019 at 2:28 pm


mireaux2019

January 10, 2019 at 2:28 pm

I am using archive-espresso_events.php in my theme for my main event listing page. In it, I am using this to pull in the events:

<?php espresso_get_template_part( 'loop', 'espresso_events' ); ?>

So now i’m trying to add a list of categories above that so people can filter the main list. I found a forum post that said to add this:

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

But it only pulls in a couple categories at a time for some reason. Also when I click the pagination of the main event listing, the categories change to something else which is really weird.

Or if there is another way to add a filter for this main event listings table, that would be fine too.


Josh

  • Support Staff

January 10, 2019 at 2:58 pm

Hi,

get_the_term_list actually shows the categories associated with the given post. Here’s a link to its WordPress developer documentation that explains more:

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

If you want to show all of your event categories you can use get_terms instead. You’ll find examples showing how to use get_terms here:
https://developer.wordpress.org/reference/functions/get_terms/#comment-288


mireaux2019

January 10, 2019 at 3:37 pm

Thank you! I have them all displaying now. The category links are the wrong URL (they’re prepending /blog/ as in /blog/event-category/categoryname) but that’s not really related to this question so I will do some more research first and make a new post about that tomorrow if I cant figure it out.

The support post ‘I can't display a list of all categories on my event listing 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.

Event Espresso