Home › Forums › Calendar Products › Events Calendar PRO › Order venues by number of events
- This topic has 24 replies, 2 voices, and was last updated 11 years, 1 month ago by Jonah.
-
AuthorPosts
-
March 26, 2013 at 2:25 pm #44121JonahParticipant
Hi Joan,
I’ve got a solution for you that requires two parts. One, a custom venue query like you’ve supplied running somewhere. Then if you put the following gist in your theme’s functions.php file, it should re-order the Venue’s by number of events for you: https://gist.github.com/PaulHughes01/5083640
Let me know whether or not that works for you!
– Jonah
March 27, 2013 at 7:48 am #44190JoanParticipantI’m so sorry but if I put these gist in my theme function it returns all the venues with 55 events. May be I need to rewrite my venue query.
March 27, 2013 at 2:21 pm #44212JonahParticipantHi Joan,
Yeah I didn’t have luck getting your custom function that displays the number of events to work properly but the gist itself should properly re-order venues based upon # of events. I tested this locally and it works for me. If you get the other custom function working, please let us know.
Thanks,
JonahApril 2, 2013 at 8:02 am #44598JoanParticipantThank you Joanh,
I ve done some modification on my funtion to get the number of events and it works!!!
April 2, 2013 at 8:29 am #44604JonahParticipantHi Joan,
That’s great to hear! Would you mind sharing your code updates? I’m thinking about writing a short tutorial on this and would like to include your code.
Thanks,
JonahApril 2, 2013 at 8:41 am #44609JoanParticipantYes of course,
function aolot_getVenueNextEvents($venue_ID)
{
global $post;
global $wp_filter;
$expos = new WP_Query();
$expos->query( array(
‘post_type’=> ‘tribe_events’,
‘eventDisplay’ => ‘upcoming’,
‘posts_per_page’ => -1,
‘meta_query’ => array(array(
‘key’ => ‘_EventVenueID’,
‘value’ => $venue_ID))
));return $expos->posts;
}April 2, 2013 at 9:37 am #44619JonahParticipantHmmm, this is not completely doing it for me. Did any other code need to be changed?
April 2, 2013 at 9:45 am #44623JoanParticipantSorry
query( array(
‘post_type’=> ‘tribe_venue’,
‘posts_per_page’ => 24,
‘paged’ => $paged));
if ($upcoming->have_posts()) :
while ($upcoming->have_posts()) :
$upcoming->the_post();
?><a href="”>
<a href="” rel=”bookmark”>
<a href="” rel=”bookmark”>Properes activitats
num_events;?>
$upcoming ) ); // tell it which query we are paginating
endif;
wp_reset_query(); // important to reset the query
?>April 2, 2013 at 9:45 am #44624JoanParticipantHope it works
April 2, 2013 at 2:52 pm #44683JonahParticipant -
AuthorPosts
- The topic ‘Order venues by number of events’ is closed to new replies.