Home › Forums › Calendar Products › Events Calendar PRO › Upcoming and past events on single venue page
- This topic has 3 replies, 2 voices, and was last updated 9 years, 3 months ago by Brook.
-
AuthorPosts
-
February 3, 2015 at 8:30 am #939757sabineviParticipant
I would like to show both upcoming and past events but only on the single venue page. I have overridden the single-venue.php template in /wp-content/mytheme/tribe-events/pro/ and found this at the bottom of the script:
<?php echo tribe_include_view_list( array('venue' => $venue_id, 'eventDisplay' => 'upcoming', 'posts_per_page' => apply_filters( 'tribe_events_single_venue_posts_per_page', 100 ) ) )?>
So I copied it and pasted it below this line, I only changed the
'upcoming'
to'past'
. Unfortunately this gave me a page without any events. I tried thewp_reset_postdata();
in between the two lines but that didn’t solve it. It’s either upcoming or past events, not both.Searching further on this forum, I found this thread which could be a solution but a lot more work.
Is there a way to use thetribe_include_view_list
function (or a similar function) twice in one page?A link to the documentation of this function would be useful too since I can’t find it in in your functions documentation.
February 4, 2015 at 11:29 pm #940161BrookParticipantHowdy Sabinevi,
That’s an interesting idea. It should be doable. I have a snippet here that sets the default date of the calendar views. So if you visit the default page, usually domain.com/events/ the default date is today. So in list view it shows all events from today forward. However, you can change this to any arbitrary date. If we change it to a past date then all events will show up, starting with the first one.
https://gist.github.com/elimn/d034dfddb9be206d9cc1
You could modify this snippet using this function as an extra conditional, to make it apply only to venues: https://theeventscalendar.com/function/tribe_is_venue/
Does that all make sense? Would that solution work? Please let me know.
Cheers!
– Brook
February 9, 2015 at 2:18 am #940842sabineviParticipantHi Brook,
Thanks for your solution. I think I must have omitted a semi-colon or comma in my initial code because I managed to get it to work.
For those of you who come here looking for answers, this is the code I used in the overridden single-venu.php:do_action('tribe_events_single_venue_before_upcoming_events') // First show upcoming events echo tribe_include_view_list( array( 'venue' => $venue_id, 'eventDisplay' => 'upcoming', 'posts_per_page' => apply_filters( 'tribe_events_single_venue_posts_per_page', 100 ) ) ); // and then those from the past wp_reset_postdata(); echo tribe_include_view_list( array( 'venue' => $venue_id, 'eventDisplay' => 'past', 'posts_per_page' => apply_filters( 'tribe_events_single_venue_posts_per_page', 100 ) ) ); do_action('tribe_events_single_venue_after_upcoming_events');
February 9, 2015 at 12:49 pm #941105BrookParticipantExcellent! I am happy to hear you got it working exactly as you wanted. Cheers!
– Brook
-
AuthorPosts
- The topic ‘Upcoming and past events on single venue page’ is closed to new replies.