Support

Home Forums Event Espresso Premium Check if an event is in a particular parent category

Check if an event is in a particular parent category

Posted: February 4, 2017 at 2:07 pm


Jerry

February 4, 2017 at 2:07 pm

I would like to output different HTML for a single event post depending on its parent event category.

For example, output ABC if an event is in Concerts/Rock or Concerts/Classical, but output XYZ if the event is in Lectures/Philosophy or Lectures/Politics. (The parent categories here being Concerts and Lectures.)

How could I do this? I’m comfortable with adding functions and editing PHP. Thanks!


Josh

  • Support Staff

February 6, 2017 at 11:31 am

Hi there,

An example of some code that can check for an event category follows:

https://gist.github.com/joshfeck/16e7d2f1ca04ac9e6b8e154ecd2d5eca

You can add the code to a function that’s hooked to an action (like in the example) or directly into a template. How and where you add the code will depend on where you want to add the custom html.

The support post ‘Check if an event is in a particular parent category’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Josh 2 years, 9 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!