Home › Forums › Calendar Products › Events Calendar PRO › Event posts auto expiration
- This topic has 8 replies, 3 voices, and was last updated 9 years, 9 months ago by
Lucy.
-
AuthorPosts
-
June 21, 2016 at 3:19 am #1129705
Lucy
ParticipantHello,
I’m sure this question has been asked before but I can’t find the answer – I see in settings you can clean up recurring events after a min of 1 month – but is there a way to expire single instances straight after the actual event?
Or do I need a 3rd party plugin to achieve this? – and if so can you recommend one that works well with The Event calendar Pro?
On my home page I want to show the next upcoming events – but as my events are set as recurring the older, past events show here instead of the ones that are actually next in real-time.
http://lucyryderdev.uk/yoganew/
Thanks in advance,
LucyJune 21, 2016 at 8:55 am #1129852Nico
MemberHi Lucy,
Thanks for reaching out to us on this!
There’s no way to set an expiration date for single events, once the event end date has passed the event (single or recurrence instance) should not show up in the views or widgets. I wasn’t able to inspect your site (it’s password protected but I guess this might be related with how you are getting events or how the recurring events are being set. Can you send me a screenshot of the recurrence settings in the backend? And de-activate directory password or describe how events are displayed on the page?
Best,
NicoJune 21, 2016 at 9:24 am #1129878Lucy
ParticipantThis reply is private.
June 22, 2016 at 1:11 pm #1130531Nico
MemberThanks for the detailed follow-up Lucy!
Ok so you mean that once an event has passed, the post for it shouldn’t be present in the back end – and if it’s part of a series of recurring events – that date’s single post will be deleted? At the moment old, past events still appear in my calendar, and as physical event posts in the back end…?
They are not deleted, they will be present as past events in the calendar and indeed as posts/events in the back-end.
Basically what I am trying to do is show the next 3 upcoming events on my home page (you can see it at the bottom) – but at the moment it does not show the next 3 classes to happen – but shows the old past classes because the posts for them still exist in the back end and they are first by date order. Does this make sense?
Makes sense. Not sure how you are getting those latest events, but you can use the function tribe_get_events (take a look at how to use it) to get the latest events ordered by start date (upcoming).
You can also use widgets to show this, including them in a sidebar or via shortcode.
Finally I’m not much familiarized with post-expiration plugins, so not sure how to advice you on their use. If you can get the events to show-up correctly in the front-end there’s probably no need for this.
Please let me know how you are getting the events for the home-page so we can see how to tweak that,
Best,
NicoJune 26, 2016 at 2:33 am #1132063Lucy
ParticipantHi Nico,
Thank for the detailed reply! I have already used the tribe_get_events function to show the upcoming even ton my home page – but they are not ignoring past event posts in the loop of them as you can see on my staging site. Can you see what I am doing wring in my code?:-
<div id="upcoming-classes" class="flexslider"> <?php $args = array( 'posts_per_page' => 3, 'orderby' => 'date', 'order' => 'ASC' ); $events = tribe_get_events($args); echo '<div class="slider-events">'; foreach ($events as $event){ // vars $id = $event -> ID; $link = get_permalink($id); $title = $event -> post_title; $venue = tribe_get_venue($id); $venueLink = tribe_get_venue_link($id); $thumb = tribe_event_featured_image($id, 'full', false); $cat = tribe_get_event_categories_custom($id, $args); $eventTime = tribe_get_start_time($id); $eventDate = tribe_get_start_date($id, false, 'jS M Y'); $excerpt = $event -> post_excerpt; echo '<div class="slide-event">'; echo '<div class="events-wrapper clearfix">'; echo $thumb; echo '<div class="info">'; echo $cat; echo '<div class="event-title">'.$title.'</div>'; echo '<div class="event-excerpt">'.$excerpt.'</div>'; echo '<div class="event-time"><i class="ion-clock"></i>'.$eventTime.'</div>'; echo '<div class="event-date"><i class="ion-calendar"></i>'.$eventDate.'</div>'; echo '<div class="event-venue"><i class="ion-location"></i>'.$venueLink.'</div>'; echo '<a class="button" href="'.$link.'">Learn More</a>'; echo '</div>'; echo '</div>'; echo '</div>'; } echo '</div>'; ?> </div>Many thanks again!
LucyJune 27, 2016 at 9:38 am #1132453Nico
MemberYou are welcome Lucy! Can you try with the following arguments instead?
$args = array( 'posts_per_page' => 3, 'eventDisplay' => 'upcoming' );
That should do the trick!
Best,
NicoJune 30, 2016 at 11:08 pm #1134362Lucy
ParticipantWhoooooooooooooooooop Nico you lifesaver!
I cannot thank you enough for your time and help, this has doe the trick and I would have gone around in circles trying other stuff if you hadn’t advised me on my array just needing tweaking.
Much appreciation to you and I hope you have a great weekend, 5 stars to you!
Lucy 🙂
July 1, 2016 at 3:58 pm #1134673Nico
MemberHeck yeah! Really glad to hear Lucy!
Thanks for the kind words, happy to be of service 🙂
I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.
Have a great weekend,
Nico -
AuthorPosts
- The topic ‘Event posts auto expiration’ is closed to new replies.
