Home › Forums › Calendar Products › Events Calendar PRO › Event Category specific sidebars
- This topic has 10 replies, 5 voices, and was last updated 8 years, 10 months ago by Support Droid.
-
AuthorPosts
-
November 4, 2011 at 1:07 pm #10595Jamie OastlerParticipant
Is there, or could there be, a way to return the array of categories which apply to an event? It seems like tribe_meta_event_cats() is close, but it outputs the result to screen so I can’t parse to do logic based on what category an event is / is not in. tribe_meta_event_category_name() doesn’t return any result when being called in my theme footer where I detect which of the sidebars to present.
I’m working with a child theme for DevPress News and have created sidebars specific for each event category.
November 4, 2011 at 3:44 pm #10609RobMemberHey there Jamie. Couldn’t you use the Events List Advanced widget, filtered down to a category-specific level, in those sidebars?
November 4, 2011 at 5:48 pm #10626Jamie OastlerParticipantQuite probably – But in order to place that widget into a category specific sidebar, I need to be able to detect which event category an event is in (or that I am looking at) in order to display.
Here is what I have in the footer so far – pastebin.com/87Y6NVBe – which detects tribe_is_event to start. I’ve also included how I handle the blog category / post detection for comparison which is the comparable depth I’m hoping for with event categories.
November 7, 2011 at 4:06 pm #10727RobMemberAwesome to hear. Would you still like me to look into this at all for you, or did the code you provided give you enough of a starting point?
November 16, 2011 at 11:42 am #11186Jamie OastlerParticipantAdditional support would be helpful. tribe_is_event() confirms that I’m on an event single view, but not which event category is involved. Need to be able to pull that info to a variable or conditional like is_category(‘text’) and in_category(‘text’) allows on the post / post category view.
November 16, 2011 at 5:10 pm #11206RobMemberAlright. I can get our developer Jonah to take a look here. Expect a response from him shortly.
November 17, 2011 at 9:16 am #11225JonahParticipantHi Jamie,
The Events Calendar and Events Calendar Pro uses taxonomies for categories so that’s why you’re not getting anywhere with is_category() or in_category(). Try using taxonomy_exists() instead and the taxonomy you’re looking for is ‘tribe_events_cat’. You can also use term_exists() to check for particular terms (categories) in the taxonomy. So for example if you have a category titled “presentations” you would use:
if(term_exists('presentations', 'tribe_events_cat')) {
//do this
}
Here is more documentation on term_exists() (http://codex.wordpress.org/Function_Reference/term_exists) and taxonomy_exists() (http://codex.wordpress.org/Function_Reference/taxonomy_exists)
Hopefully that helps but let us know if you have any other questions with this.
Regards,
JonahDecember 16, 2011 at 2:00 pm #12460GregParticipantI must be doing something wrong because when I use the “if term exists” code above in my “table.php” (ie. calendar grid view) file it outputs the “do this” for ALL of my events, not just the ones assigned to the category I’m trying to query. I have a category labeled “Private Party” and I want just the words “Private Party” to display on the calendar. For all other categories I want my usual venue, address, etc to display.
December 16, 2011 at 2:06 pm #12461GregParticipantThis seems to make it work: http://alex.leonard.ie/2011/06/30/wordpress-check-if-post-is-in-custom-taxonomy/
December 16, 2011 at 5:28 pm #12464RobMemberAh, excellent to see you got that figured out. So are you all set on this issue Greg?
July 2, 2015 at 5:00 pm #974924Support 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 ‘Event Category specific sidebars’ is closed to new replies.