• 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://ww.wp.xz.cn/plugins/event-organiser/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    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

    (@maorb)

    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

    (@stephenharris)

    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

    Thread Starter maorb

    (@maorb)

    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.