Home › Forums › Calendar Products › Events Calendar PRO › Pulling Past and Upcoming Event In Single Event Page
- This topic has 8 replies, 3 voices, and was last updated 9 years, 5 months ago by
Cliff.
-
AuthorPosts
-
November 15, 2016 at 9:50 am #1192602
RANDY
ParticipantHi,
I am working on a custom single event page template.
I am trying to pull past events in one box and pull upcoming events in another box.
Each box is only suppose to pull two events.
What is the best way to tackle this?
November 15, 2016 at 8:48 pm #1192955Cliff
MemberHi Randy.
You should reference our Themer’s Guide to get started.
As far as what to include in your template, you might want to use one of our plugin’s shortcodes, which has a “limit” argument.
If you need some coding help, you may want to ask your developer or reference our documentation and list of known customizers.
November 16, 2016 at 8:13 am #1193148RANDY
ParticipantHi Cliff,
Thanks for pointing out that section.
I am looking at the shortcodes and it doesn’t give the option to provide an event list on past events?
This is the shortcode I’m looking at: [tribe_events_list limit=”10″]
November 16, 2016 at 9:24 am #1193295Cliff
MemberYou should probably just use tribe_get_events(), or at least you’ll need to filter the tribe_events_list shortcode’s use of it.
Our shortcodes really just run the respective widget’s code. In this case, the tribe_events_list shortcode runs the Advanced List Widget that comes with PRO, which adds some functionality to TEC core’s (non-Advanced) List Widget, which you can see the code for here: https://github.com/moderntribe/the-events-calendar/blob/4.3.2/src/Tribe/List_Widget.php#L104
I hope this helps!
November 16, 2016 at 10:27 am #1193339RANDY
ParticipantHi Cliff,
I noticed that would be the case after searching through tons of posts regarding this feature.
I will go ahead and do that, thanks.
November 16, 2016 at 10:53 am #1193352Cliff
MemberSounds good. I’ll leave this thread open in case you have a code snippet you come up with to share with others or need another pair of eyes on.
Please note that threads get Closed automatically after a couple weeks of inactivity. If it does get Closed, please open a new thread, adding your current problem description and also linking back to this thread.
Thank you!
November 16, 2016 at 11:31 am #1193383RANDY
ParticipantHere is my code for anyone. Of course, change the classes and such.
<?php // Ensure the global $post variable is in scope global $post; // Retrieve the past 2 events $events = tribe_get_events( array( 'posts_per_page' => 2, 'order' => DESC, 'eventDisplay' => 'past', ) ); // Loop through the events: set up each one as // the current post then use template tags to // display the title and content foreach ( $events as $post ) { setup_postdata( $post ); // This time, let's throw in an event-specific // template tag to show the date after the title! echo '<div class="type-tribe_events"><div class="tribe-mini-calendar-event">'; echo '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">'; echo tribe_event_featured_image( null, 'thumbnail' ); echo '</div><div class="col-xs-12 col-sm-12 col-md-8 col-lg-8"><h2><a href="">'; echo "$post->post_title"; echo '</a></h2>'; echo '<p class="tribe-events-schedule"><span class="tribe-event-date-start">On-Demand Available</span> '; echo tribe_events_get_the_excerpt( null, wp_kses_allowed_html( 'post' ) ); echo '</div></div></div>'; } ?>November 16, 2016 at 1:33 pm #1193461Cliff
MemberI’m very glad you were able to get things working how you desired, and thanks for sharing!
-
AuthorPosts
- The topic ‘Pulling Past and Upcoming Event In Single Event Page’ is closed to new replies.
