• Hi everyone!

    I have a question. On my single event page, at the very bottom of the page, there are ‘Prev:’ and ‘Next:’ links. Those links open previous and next event (based on the one displayed at the page) BUT they open events based on a PUBLISHED date not on EVENT STARTING date. So, for example, if I publish the event today but the starting time of that event is 10 days from today and if I publish an event tomorrow and that event will start in 5 days, if I am on a single page of an event from yesterday and try to open the next event, the one which will start in 10 days will be opened instead of the one that starts in 5 days, just because the publishing date is closer to the event I am currently on. I’d like the next one to be the one that will happen next, not the one that I published after I publish the one I am currently on.

    Thanks in advance for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support angelo_nwl



    I think that is more of a WordPress thing than EM, this is because EM is using custom post type; you can try to look into wp_query to modify this.

    It actually is an EM thing…

    I have written a tutorial to get correct event navigation for Events Manager. Check it out here: https://www.stonehengecreations.nl/correct-event-navigation-prev-next-on-single-events/

    Thread Starter vlaja


    Hi guys,

    @duisterdenhaag for some reason, the link with your solution is not accessible at the moment so I am unable to see the fix. However, I’ve managed to create a fix in the meantime, this is my code:

    $wppsCurrentEvent = do_shortcode('[event]#_EVENTDATES[/event]');
    $wppsAllEventsDates = explode(",", do_shortcode('[events_list scope="all" limit="1000"]#_EVENTDATES,[/events_list]'));
    if(in_array($wppsCurrentEvent, $wppsAllEventsDates)){
    $wppsNextEventInArray = array_search($wppsCurrentEvent, $wppsAllEventsDates) + 1;
    $wppsPrevEventInArray = array_search($wppsCurrentEvent, $wppsAllEventsDates) - 1;
    $wppsNextEvent = EM_Events::output(array('scope'=>'all', 'limit'=>1, 'offset'=> $wppsNextEventInArray));
    $wppsPrevEvent = EM_Events::output(array('scope'=>'all', 'limit'=>1, 'offset'=> $wppsPrevEventInArray)); ?>

    $wppsNextEvent and $wppsPrevEvent variables just need to be printed in order for prev and next links based on event date to be displayed.

    • This reply was modified 4 years, 5 months ago by vlaja.

    You should be able to visit the site now.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Next event based on event date – not based on publishing date’ is closed to new replies.