• Resolved publicradio

    (@publicradio)


    So I want to have a shortcode on a page, where I list all past events. This list is organized by year. So for one-off events, I want it to name the event and list the day it occurred. For recurring events, though, I want it to list only the main instance (template) of the event, and the start and end dates.

    If the recurring event started in, say, 2017, and ended in 2019, I want the event to show up under 2019 but say ‘Event Name, March 2017 — May 2019’. How do I accomplish this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter publicradio

    (@publicradio)

    https://pastebin.com/kwesz72g

    I don’t know if this snippet is working for anyone, but for me it does not. When enabled, it just returns and empty set.

    Thread Starter publicradio

    (@publicradio)

    OK, I did get this working, somewhat:

    https://pastebin.com/aipvNNmF

    I modified it to have this in the loop:

    
    $blacklist = array();
    foreach($events as $event_key => $EM_Event){
      if ( !empty($EM_Event->recurrence_id) ){
        if(in_array($EM_Event->recurrence_id,$blacklist)){
          unset($events[$event_key]);
        }
        $blacklist[] = $EM_Event->recurrence_id;
      }
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show only one instance of recurring events’ is closed to new replies.