Event Category specific sidebars

Home Forums Calendar Products Events Calendar PRO Event Category specific sidebars

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #10595
    Jamie Oastler
    Participant

    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.

    #10609
    Rob
    Member

    Hey there Jamie. Couldn’t you use the Events List Advanced widget, filtered down to a category-specific level, in those sidebars?

    #10626
    Jamie Oastler
    Participant

    Quite 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.

    #10727
    Rob
    Member

    Awesome 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?

    #11186
    Jamie Oastler
    Participant

    Additional 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.

    #11206
    Rob
    Member

    Alright. I can get our developer Jonah to take a look here. Expect a response from him shortly.

    #11225
    Jonah
    Participant

    Hi 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,
    Jonah

    #12460
    Greg
    Participant

    I 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.

    #12461
    Greg
    Participant
    #12464
    Rob
    Member

    Ah, excellent to see you got that figured out. So are you all set on this issue Greg?

    #974924
    Support Droid
    Keymaster

    This 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.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Event Category specific sidebars’ is closed to new replies.