Using a category slug as a class

Home Forums Calendar Products Events Calendar PRO Using a category slug as a class

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #15301
    Dale-Anthony
    Participant

    Hey,
    I’m using a loop from the examples on the docs pages to show a list of events, I’m just wondering if there’s a template tag I can use to display the category slug as a class?

    #15322
    Rob
    Member

    Hey Dale-Anthony. Not sure about this one myself, but let me see if Jonah has any ideas when he hits the forums this morning.

    #15338
    Jonah
    Participant

    Hi Dale-Anthony, sure, you’d have to use something like wp_get_object_terms for individual posts (http://codex.wordpress.org/Function_Reference/wp_get_object_terms) to pull in the events categories and then get the slug for each term to use for the class name. You can use the sample WP provides for an idea or this pastebin example for get_terms for another idea: http://pastebin.com/zz9hfTUQ

    Good luck!

    #15342
    Dale-Anthony
    Participant

    Thanks for pointing me in the right direction, got this working 🙂

    #15360
    Rob
    Member

    Excellent! Thanks Jonah.

    Dale-Anthony: as always, let us know what else we can do. Have a great weekend.

    #975677
    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 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Using a category slug as a class’ is closed to new replies.