Home › Forums › Calendar Products › Events Calendar PRO › If-Then based on Event Category Function?
- This topic has 6 replies, 3 voices, and was last updated 8 years, 10 months ago by Support Droid.
-
AuthorPosts
-
February 13, 2013 at 11:28 am #32593StephParticipant
Hello,
I am on the web team for informedmedicaldecisions.org. We are adding an area to the site that uses different template parts for a specific category of events. We have also purchased Events Calendar Pro, as well as the Eventbrite Add-on.
The problem:
Running a nice function if/then statement based on an event’s inclusion in a category.We do have the following working properly and tested:
. events calendar settings theme: Default Events Theme
. events folder in our theme with customized files named:
.. ecp-page-template.php
.. ecp-single-template.php
. special template parts do work in these ecp files when the if/then statement is not involved.
Here is a link to the messy solution I created: http://pastebin.com/w1ry6HUmIt seems to me that there must be a better way than writing my own function, but I have had no luck finding an appropriate function in your documentation.
Obviously, coding is not my main occupation.
Any help is welcome. This solution seems like it will not stand up to updates.
Thanks, Rosemary
February 13, 2013 at 1:29 pm #32601StephParticipantAnd…. I just found a place where this messy fix is not working:
>http://informedmedicaldecisions.org/events/category/sdm-month-events/month/Should have the same header, footer, sidebar as http://informedmedicaldecisions.org/sdm-month-events-page/
February 13, 2013 at 1:43 pm #32602StephParticipantOk, solved that one then by having my klugy function (show above) called in ecp-single-template.php and the tribe_meta_event_category_name function called in ecp-page-template.php.
Would still love to know if there is a better solution than my own function…February 13, 2013 at 3:43 pm #32618BarryMemberPossibly by using the tribe_event_in_category() function, which accepts a category slug and optionally the event ID (otherwise it just assumes you are interested in the current event).
if (tribe_event_in_category('my-category-slug')) { /* Do something */ }
February 14, 2013 at 2:10 pm #32679StephParticipantThanks! This is the kind of think I’ve been looking for!
February 14, 2013 at 2:27 pm #32683BarryMemberGreat!
July 7, 2015 at 6:26 am #978615Support DroidKeymasterThis 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. -
AuthorPosts
- The topic ‘If-Then based on Event Category Function?’ is closed to new replies.