Displaying Categories

Home Forums Calendar Products Events Calendar PRO Displaying Categories

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1067812
    fifteen15studios
    Participant

    I 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!
    Brendan

    #1068398
    Geoff
    Member

    Hi 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!
    Geoff

    #1069641
    fifteen15studios
    Participant

    Thanks! 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!
    Brendan

    #1070243
    Geoff
    Member

    Sure 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!
    Geoff

    #1070440
    fifteen15studios
    Participant

    Huh. 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!
    Brendan

    #1070857
    Geoff
    Member

    Hi 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,
    Geoff

    #1081996
    Support Droid
    Keymaster

    This 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.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Displaying Categories’ is closed to new replies.