tribe_is_event_venue

Home Forums Calendar Products Events Calendar PRO tribe_is_event_venue

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #107104
    tobias
    Participant

    And here comes my next issue:

    undoubtly there is a function “tribe_is_event_venue”, and it’s pretty clear what it does. 😉 But I don’t get it to work somehow. What I wanna do is installing a switch to change the appearance of the upcoming event list, depending on whether it is part of a single venue detail page or a standalone list.

    So when my single-venue.php calls tribe_include_view_list, I expected that I could call tribe_is_event_venue inside list/content.php to decide about which headline to use and other layout stuff. But nothing happens. I also tried declaring a global right before the call of the list view and calling that in the list view, but that also doesn’t work.

    Also, I tried to work around this by calling the venue ID in the list view, hoping it would return zero in case it’s not a single venue, but that also doesn’t work, because funny enough, in case it’s called from a single venue page, the ID of that venue is returned correctly, but in case it’s a regular list view call, the ID of the venue of the first listed event is returned. So that doesn’t serve as a switch either.

    It’s probably a newbie question, but I can’t figure out how to differentiate the list view context here. I’d appreciate any hints.

    Thanks in advance,
    Tobias

    #107199
    Barry
    Member

    The approach with setting a global in the outer template and detecting it from the inner template certainly ought to work.

    The reason tribe_is_event_venue() only works in the outer template (single-venue.php) is essentially because it inspects the global $wp_query object, however this is modified before the inner template (list/content.php) runs.

    Can you share the code – perahps via Pastebin or Gist – that you tried when tackling this with the global variable approach? I see no reason why that wouldn’t work … perhaps the global just wasn’t pulled into scope within the inner template?

    #109657
    tobias
    Participant

    Thank you, now I see why it wasn’t working. Plus, I did the global variable thing wrong, now I got it figured out and the switch works as desired. Thanks again and best regards!

    #136091
    Barry
    Member

    (Closing this out!)

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