The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Events Manager
[resolved] Image on First Recurrence of Recurring Event (5 posts)

  1. joeventures
    Posted 3 years ago #

    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.)


  2. agelonwl
    Posted 3 years ago #

    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


  3. joeventures
    Posted 3 years ago #

    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.

  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    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

  5. joeventures
    Posted 3 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic