WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Image on First Recurrence of Recurring Event

[Resolved] Image on First Recurrence of Recurring Event

  • joeventures
    Member

    @joeventures

    I’m using the template files to customize the look of a calendar of our class schedule. For our classes that have more than one session (e.g., Class is every Tuesday, 10:30 – 1:30…) we use recurring events.

    To make sure it is clear when each class offering begins, I’d like to have Events Manager display an image to mark, “This is when the class begins.”

    In the template file, there’s a nice foreach loop that runs through the $calendar[‘cells’] array that is passed to the template. The array includes information about each event. Here’s the information I can find for each recurrence within each cell:

    recurrence_id => 127
    recurrence => 0
    recurrence_interval => 1
    recurrence_freq => daily
    recurrence_days => 0
    recurrence_byweekno => 1
    recurrence_byday =>

    None of this information seems to change from one recurrence of a recurring event to the next. Is there some way of figuring out that I’m on the first recurrence?

    (I’m quite sure that this would not work if I try to just have the image display the first time a recurrence_id appears. Some recurring events span multiple months.)

    http://wordpress.org/extend/plugins/events-manager/

Viewing 4 replies - 1 through 4 (of 4 total)
  • agelonwl
    Member

    @angelonwl

    how about adding a new loop just like this thread – http://wordpress.org/support/topic/plugin-events-manager-cannot-figure-howto-user-category-colors-in-calendar-smallphp-file?replies=2 then maybe you can add new condition and you can also use placeholders

    Placeholders

    joeventures
    Member

    @joeventures

    Hmm… Possibly. I wouldn’t be able to do a new $calendar[‘cells’] loop as in that thread, though. If the recurring event spans multiple months, then the first instance of a recurring event in its second month would appear as though that’s when the event begins.

    Having said that….

    Is it possible to get the earliest date of a recurring event based on the id? I can’t seem to figure out a way — maybe there’s something I’m missing with that. If I can get the date of the earliest instance of a recurring event, then the rest should be a piece of cake.

    Plugin Author Marcus
    Participant

    @netweblogic

    you’d need to query the db with something like

    $events = EM_Events::get(array('recurrence'=>127, 'limit'=>1, 'scope'=>'all', 'orderby'=>'event_start_date', 'order'=>'ASC'));

    you should get an array of one EM_Event object

    joeventures
    Member

    @joeventures

    Thank you! I think this is what I’m looking for. I knew there was a method I was missing somewhere 🙂

    I *think* I can take it from here. There’s still more to figure out. But what I found is that I can get an array of all published recurring events with this query:

    $events = EM_Events::get(array(‘recurring’=> 1, ‘scope’ => ‘all’, ‘status’ => ‘1’));

    I can use that to get all the start dates and IDs.

    Thanks for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Image on First Recurrence of Recurring Event’ is closed to new replies.