Conditonal categories – for example, "if is in category 'fruit'"

WordPress Event Management, Calendars & Registration Forums General Question Conditonal categories – for example, "if is in category 'fruit'"

This topic contains 2 replies, has 2 voices, and was last updated by  TS 9 years, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #17166

    Hello,

    Apologies if this is documented somewhere, I have really hit a wall with a site I’m developing and my mind is a bit of a blank.

    In WordPress, outside the loop I can specify that certain things happen if the post is in a certain category. For example:

    if ( in_category('fruit') ) { ... }
    

    I know that Event Organiser uses tax and terms, but I cannot figure out how to write a conditional request for my events.

    I need my event category archives to show different hero images depending on which category archive is being viewed, and since there does not appear to be featured images for categories (I believe), I am trying to find a way around it.

    Please save my sanity and help me to write a conditional request for particular event categories (outside the loop).

    Thank you very, very much.

    TS
    #17176

    has_term() is what you’re after (see codex: http://codex.wordpress.org/Function_Reference/has_term ). The taxonomy for event categories is event-category.

    Stephen Harris
    #17184

    Sanity restored! Thanks so much, Stephen.

    TS
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.