eo_insert_event Since 1.5
Located at includes/event.php
This functions inserts a post of event type, with data given in the $post_data and event data given in $event_data. Returns the post ID.
eventorganiser_save_event passing event (post)
The event data array can contain
schedule=> (custom | once | daily | weekly | monthly | yearly) -- specifies the reoccurrence pattern
schedule_meta=> * For monthly schedules, * (string) BYMONTHDAY=XX to repeat on XXth day of month, e.g. BYMONTHDAY=01 to repeat on the first of every month. * (string) BYDAY=ND. N= 1|2|3|4|-1 (first, second, third, fourth, last). D is day of week SU|MO|TU|WE|TH|FR|SA. E.g. BYDAY=2TU (repeat on second tuesday) * For weekly schedules, * (array) Days to repeat on: (SU,MO,TU,WE,TH,FR,SA). e.g. set to array('SU','TU') to repeat on Tuesdays & Sundays. * Can be left blank to repeat weekly from the start date.
frequency=> (int) positive integer, sets frequency of reoccurrence (every 2 days, or every 3 days etc)
all_day=> 1 if its an all day event, 0 if not
start=> start date (of first occurrence) as a datetime object
end=> end date (of first occurrence) as a datetime object
schedule_last=> START date of last occurrence (or upper-bound thereof) as a datetime object
number_occurrences=> Instead of specifying
schedule_lastyou can specify the number of occurrence a recurring event should have.
This is only used if
schedule_last is not, and for daily,
weekly, monthly or yearly recurring events.
include=> array of datetime objects to include in the schedule
exclude=> array of datetime objects to exclude in the schedule
The following example creates an event which starts on the 3rd December 2012 15:00 and ends on the 4th December 15:00 and repeats every 4 days until the 25th December (So the last occurrence actually ends on the 23rd).
$event_data = array( 'start'=> new DateTime('2012-12-03 15:00', eo_get_blog_timezone() ), 'end'=> new DateTime('2012-12-04 15:00', eo_get_blog_timezone() ), 'schedule_last'=> new DateTime('2012-12-25 15:00', eo_get_blog_timezone() ), 'frequency' => 4, 'all_day' => 0, 'schedule'=>'daily', ); $post_data = array( 'post_title'=>'The Event Title', 'post_content'=>'My event content', ); $e = eo_insert_event($post_data,$event_data);
||array of data to be used by wp_insert_post.|
||array of event data|
Return value summary
||the post ID of the updated event|