Home › Forums › Calendar Products › Events Calendar PRO › tribe_is_event_venue
- This topic has 3 replies, 2 voices, and was last updated 12 years ago by
Barry.
-
AuthorPosts
-
February 20, 2014 at 10:36 am #107104
tobias
ParticipantAnd 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,
TobiasFebruary 20, 2014 at 1:33 pm #107199Barry
MemberThe 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?
February 26, 2014 at 9:19 am #109657tobias
ParticipantThank 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!
April 18, 2014 at 6:26 am #136091Barry
Member(Closing this out!)
-
AuthorPosts
- The topic ‘tribe_is_event_venue’ is closed to new replies.
