Title: get next/prev events with API function
Last modified: August 31, 2016

---

# get next/prev events with API function

 *  [maorb](https://wordpress.org/support/users/maorb/)
 * (@maorb)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/get-nextprev-events-with-api-function/)
 * Hi,
 * I want that in the single event template, or/and in the events archive template,
   to put and add a link/button to show the next/prev day with events and link to
   it (i.e. domain.com/events/event/on/2016/02/09/ etc.)
 * Does the plugin have an API function that can help me doing this?
 * Thanks
 * [https://wordpress.org/plugins/event-organiser/](https://wordpress.org/plugins/event-organiser/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Stephen Harris](https://wordpress.org/support/users/stephenharris/)
 * (@stephenharris)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/get-nextprev-events-with-api-function/#post-7040437)
 * Yes, but events can recur – and will still only have one page. So if you are 
   have an event on dates X, Y and Z and you’re on that event page – which date 
   do you pick to link to the next/previous day? X, Y or Z?
 * If you only have single events then there is no ambiguity. You can use the following
   to get the event’s start date:
 *     ```
       $start = eo_get_the_start( DATETIMEOBJ );
            $day_after = clone $start;
            $day_after->modify( '+1 day' );
            echo eo_get_event_archive_link( $day_after )
       ```
   
 * and similarly for the day beofre.
 *  Thread Starter [maorb](https://wordpress.org/support/users/maorb/)
 * (@maorb)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/get-nextprev-events-with-api-function/#post-7040547)
 * Thank you. I assum that in this case there are only single events, but there 
   are days with only 1 event, and other days with 2 or more events, so in the calendar
   widget, it sometimes will lead to the single event and sometimes to the archive
   of the day, so in the next link I should know if the next link should be to the
   singular day or to the archive, is there an way to do this, or does the _eo\_get\
   _event\_archive\_link_ function already handles these cases?
 * Thanks
 *  Plugin Author [Stephen Harris](https://wordpress.org/support/users/stephenharris/)
 * (@stephenharris)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/get-nextprev-events-with-api-function/#post-7040556)
 * No, it will also return the link to the (in this case) day page for the following
   day. Regardless of whether that day as 100, 1 or even 0 events.
 * If you wanted to link to the next day with an event, you’ll need to obtain that
   date using `eo_get_events()` and request events which start after the current
   day you’re on. The codex has details on that function: [codex.wp-event-organiser.com/function-eo_get_events.html](http://codex.wp-event-organiser.com/function-eo_get_events.html)
 *  Thread Starter [maorb](https://wordpress.org/support/users/maorb/)
 * (@maorb)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/get-nextprev-events-with-api-function/#post-7040582)
 * Thank you very much for your help, I’ll take a deeper look in the codex as well.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘get next/prev events with API function’ is closed to new replies.

 * ![](https://ps.w.org/event-organiser/assets/icon-256x256.png?rev=978123)
 * [Event Organiser](https://wordpress.org/plugins/event-organiser/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/event-organiser/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/event-organiser/)
 * [Active Topics](https://wordpress.org/support/plugin/event-organiser/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/event-organiser/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/event-organiser/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [maorb](https://wordpress.org/support/users/maorb/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/get-nextprev-events-with-api-function/#post-7040582)
 * Status: not resolved