Home › Forums › Calendar Products › Events Calendar PRO › Countdown widget not skipping to next event
- This topic has 5 replies, 3 voices, and was last updated 9 years, 8 months ago by
Riccardo.
-
AuthorPosts
-
August 28, 2016 at 10:54 pm #1156950
Riccardo
ParticipantHi there guys, I have just realised that the countdown widget is not skipping to next upcoming event. Once the events is reached, it will show “No upcoming events!”….
Is this by design?August 29, 2016 at 3:20 am #1156998Riccardo
ParticipantI have fixed the problem creating a custom shortcode, however I’d like to understand why the widget won’t work as (I) expected. It should be that once the event is expired it will skip to the next upcoming automatically, otherwise users are forced to manually update the widget… crazy!
Now,as stated here function tribe_get_events will return also events started earlier than the supplied date, I had to loop in the next (6 for me) events to verify if the start date is equal or greater than the requested start date.
Seems strange to me really, both the widget behaviour and the tribe_get_events …..
function my_event_countdown($atts, $content = null) { $date = new DateTime('tomorrow'); $result = $date->format('Y-m-d H:i:s'); $events = tribe_get_events( array( 'eventDisplay' => 'list', 'posts_per_page' => 6, 'start_date' => date( $result ) ) ); foreach ( $events as $post ) { setup_postdata( $post ); if(substr($post->EventStartDate,0,10) >= substr($result,0,10 )) { break; } } $a = '[tribe_event_countdown id="'.$post->ID.'"]'; return do_shortcode($a); } add_shortcode( 'next_countdown','my_event_countdown');-
This reply was modified 9 years, 8 months ago by
Riccardo.
August 29, 2016 at 4:25 pm #1157345Andras
KeymasterHello Riccardo,
Thank you for posting your solution!
How the plugin actually works is that it counts down, and once it reaches the event it shows the message <u>until the end time of the event</u>.
Once the event is over, it will automatically show the next event.I hope this explains.
Cheers,
AndrasAugust 30, 2016 at 4:43 am #1157485Riccardo
ParticipantThanks for clarifying Andras. The behaviour is not useful in my case because once the event begin date is expired it should be more relevant to immediately show the next upcoming.
Cheers! 🙂
August 30, 2016 at 9:45 am #1157675Andras
KeymasterHey Riccardo,
Thanks for your feedback! I totally understand there are situations where showing the next event immediately is needed. Good job on the code!
Since this is marked resolved I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic on the forum and we can help you out.
Cheers,
Andras -
This reply was modified 9 years, 8 months ago by
-
AuthorPosts
- The topic ‘Countdown widget not skipping to next event’ is closed to new replies.
