Home › Forums › Calendar Products › Events Calendar PRO › Displaying Categories
- This topic has 6 replies, 3 voices, and was last updated 10 years, 1 month ago by
Support Droid.
-
AuthorPosts
-
February 4, 2016 at 10:54 am #1067812
fifteen15studios
ParticipantI would like to display the categories under which each event is listed in my event results. For example, in the default list view, the title, cost, address, time, and summary display, but I would also like to list the categories too. If there’s a way to do this, I would like to know how to list both the ID and the name of the category (as I may use both).
Thanks!
BrendanFebruary 5, 2016 at 11:15 am #1068398Geoff
MemberHi Brendan — hope all is well, dude!
Good question. You can add the category by editing the list/single-event.php template and using the tribe_get_event_categories() function where you would like the category to display.
Will that work for you? Let me know. 🙂
Cheers!
GeoffFebruary 8, 2016 at 10:38 am #1069641fifteen15studios
ParticipantThanks! I think that might work.
However, I’m a person who doesn’t really understand documentation. (Seriously, I do not know what this is asking me to do.) I’m trying to use the function in my single-event.php file like the others, which are working fine, but it doesn’t seem to be working.
I tried the following and none of these seem to be showing me data:
$theid = tribe_get_venue_id(); tribe_get_event_categories($theid);$theid = tribe_get_venue_id(); echo tribe_get_event_categories($theid);tribe_get_event_categories();echo tribe_get_event_categories();Doesn’t seem to work. I’m not sure why, but is there something I’m doing wrong?
Thanks!
BrendanFebruary 9, 2016 at 6:32 am #1070243Geoff
MemberSure thing! My apologies for being so vague in my last reply–I was making way too many assumptions and can clarify more here.
You’re editing the correct file (list/single-event.php) so that’s good to go.
From there, you can add this anywhere in the template where you would like the categories to be listed:
<?php echo tribe_get_event_categories(); ?>That will display a bulletpoint list of the categories an event has. For example, I tested it and pasted that snippet as Line 50 in the template and that added the categories right below the event’s date information.
Let me know if this helps or if there’s anything else I can do to help clarify things and I’d be happy to.
Cheers!
GeoffFebruary 9, 2016 at 12:13 pm #1070440fifteen15studios
ParticipantHuh. Now it’s working. I wonder why it wasn’t before?
Well, thanks for that explanation! That’s really helpful!I do have another question, though. Right now the function displays as a list with a header. That’s great, but I’m going to craft my own code around this so I can display it the way we need to. (I’m planning to display a symbol for each category that we associate with each id.) How would I do this?
Thanks!
BrendanFebruary 10, 2016 at 7:12 am #1070857Geoff
MemberHi Brendan,
Awesome, I’m glad that helps and works!
If you’re going to create a list of categories and customize it from there, I would suggest using a more advanced query for event categories using WordPress functions. Event categories are registered as a custom taxonomy, so they can be called using the get_the_terms() function and that can be used to create a custom output for the event categories, including icons for each one.
We are fairly limited in how much we can support custom development questions like this, but hopefully the link above and the examples in there will be a solid blueprint to get you started in that direction. Let me know!
Thanks,
GeoffFebruary 25, 2016 at 8:35 am #1081996Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Displaying Categories’ is closed to new replies.
