Home › Forums › Calendar Products › Events Calendar PRO › Removing expired events
- This topic has 2 replies, 3 voices, and was last updated 10 years, 1 month ago by
Support Droid.
-
AuthorPosts
-
February 9, 2016 at 7:17 am #1070269
Robert
ParticipantMy question is 2 fold.
1. Is there a way to have expired events removed from the calendar after X amount of time?
2. I created a list style of events that show the next upcoming events and it sits on top of my calendar as shown here below (/upcoming-events).
tribe_get_template_part( 'month/upcoming-events' );
// Tribe Bar
tribe_get_template_part( 'modules/bar' );// Main Events Content
tribe_get_template_part( 'month/content' );do_action( 'tribe_events_after_template' );
In this event view it’s showing events that have past already in January, e.g. http://cl.ly/1d1F3A0r2F2S
Is there a way to make it so that it doesn’t show these events since they’ve already past? Below is my code for the upcoming events list.
global $post;// Retrieve the next 5 upcoming events
$events = tribe_get_events( array(
'posts_per_page' => 5,
//'start_date' => new DateTime()
) );echo '<ul id="upcoming-events">';
// 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 );echo '
- ';
// This time, let's throw in an event-specific
// template tag to show the date after the title!
echo ''; echo the_title(); echo '';
echo '<br />';
echo 'When: ' . tribe_get_start_date();
echo '<br />';
echo 'Where: ' . tribe_get_venue(); if (tribe_get_city() !='') : echo ' - ' . tribe_get_city(); endif; if (tribe_get_state() !='') : echo ', ' . tribe_get_state(); endif;
//echo tribe_get_city();echo '<br />';
echo '
';
}echo '';
?>
February 9, 2016 at 4:11 pm #1070503Geoff B.
MemberGood evening Lindsay and welcome back!
Thank you for reaching out to us.
We will gladly try to assist you on these topics.1. Is there a way to have expired events removed from the calendar after X amount of time?
The short answer is yes. Depending on how forceful you want to be, you can:
- Use a filter on the tribe_get_events function as detailed in our knowledge base
- Delete these older events automatically using a plugin
Is there a way to make it so that it doesn’t show these events since they’ve already past? Below is my code for the upcoming events list.
Perhaps you can draw inspiration from my colleague Barry as explained in the following post ?
Let me know if that helps.
Have a great day!
Geoff B.
February 24, 2016 at 8:35 am #1081495Support 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 ‘Removing expired events’ is closed to new replies.
