Home › Forums › Calendar Products › Events Calendar PRO › WP Query for Individual Venue
- This topic has 6 replies, 3 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
November 21, 2013 at 10:21 am #77866
Marcus
ParticipantThe Events Calendar Pro already provides the ability to list events by venue, but I have a situation where some venues have their own pages, and I’d like to briefly list the next three events on that page in a sidebar. I’ve been able to do something similar to this regarding categories by using the wp_query like so:
$wp_query->query(‘posts_per_page=’.$show_posts.
‘&post_type=tribe_events’.
‘&tribe_events_cat=’.$my_category_slug
);Following suit, I attempted variables like “tribe_events_venue” and “tribe_events_venue_id”, but that didn’t take. I also couldn’t find where parameters like “tribe_events_cat” are currently documented for 3.0.
In any case, how would I establish a similar query given the ID or slug of the Venue? Thanks for your time and insight.
November 22, 2013 at 9:02 am #78209Chris
ParticipantIt seems the tag you’re looking for is (as opposed to “tribe_events_cat”) is “tribe_venue”
-Chris
November 22, 2013 at 10:00 am #78228Marcus
ParticipantThanks for the suggestion! Perhaps I’m using it wrong, but it seems “tribe_venue” has no affect on the query, whether I use a venue’s slug or its ID like so:
$wp_query->query(‘posts_per_page=5’.
‘&post_type=tribe_events’.
‘&tribe_venue=art-studio’
);or:
$wp_query->query(‘posts_per_page=5’.
‘&post_type=tribe_events’.
‘&tribe_venue=1384’
);Either query just returns the next five upcoming events regardless of venue, as opposed to just the ones appearing in the “art-studio” venue. Am I doing something wrong here, or is this not the right way to go about it?
November 24, 2013 at 1:05 pm #78394Marcus
ParticipantOkay, I take it this seemingly-simple request is beyond this plug-in’s capabilities. Thanks.
November 24, 2013 at 3:24 pm #78398Marcus
ParticipantIn case anyone else is having this problem, I did figure out the solution by dissecting the existing Tribe Events Pro class files. The easiest way to form this query is by using the TribeEventsQuery::getEvents method, documented here:
http://docs.tri.be/Events-Calendar/class-TribeEventsQuery.htmlSpecifically, here’s how I setup the query the above situation:
$wp_query = TribeEventsQuery::getEvents( array(‘venue’ => 1384, ‘eventDisplay’ => ‘upcoming’, ‘posts_per_page’ => 5 ), true );November 26, 2013 at 7:59 am #78657Chris
ParticipantHi Marcus,
My apologies for losing track of this ticket. Glad you got it figured out 🙂-Chris
July 7, 2015 at 6:30 am #982424Support Droid
KeymasterThis 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 ‘WP Query for Individual Venue’ is closed to new replies.
