Conditional Categories

Home Forums Calendar Products Events Calendar PRO Conditional Categories

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #25791

    I want to write some code into one of my template file that says if the category id (for the Events Calendar Pro) is 51 (for example), then I want to echo some code. Is this possible to incorporate into the plugin? I know it’s fairly simple in WordPress’s infrastructure, but I can’t seem to get WordPress’s “in_category();” function to work with this. Any help is appreciated. Thanks!

    #25798
    Barry
    Member

    You could try using WordPress’s has_term() function instead: http://pastebin.com/zgH6SXRA

    #26408
    Andrew
    Member

    Barry-
    My taxonomy is: tribe_events_cat
    My category id for the calendar category is: 287
    My slug is: opc-2nd-executive
    How do those elements fit into your code?

    #26409
    Barry
    Member

    Hi Andrew. You need only set $id to 287. The slug is already in there and it will (try to) determine the post ID automatically.

    If you take a peak at the WordPress documentation for has_term() you’ll see how the pieces fit together.

    #26410
    Barry
    Member

    * Made a typo there – the slug is irrelevant here, what I meant to say is the taxonomy is already in the code. It’s represented by TribeEvents::TAXONOMY.

    #27078
    Barry
    Member

    Hi Andrew, Kindra: I’m guessing you don’t need any further support here and will close this thread. Please shout back before the end of the week if you need additional help.

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