Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'save_post', 'run_when_post_saved');
- function run_when_post_saved($post_id)
- {
- $post = get_post($post_id);
- if($post->post_type=="my-custom-post" && $post->post_status == "publish") {
- //ADD event
- $eventSettings = array(
- 'post_title' => 'Event test for '.$post->post_title,
- 'post_name' => 'vent test for '.$post->post_title,
- 'post_status' => 'publish',
- 'post_content' => '',
- "post_type" => "tribe_events",
- "original_post_status" =>"publish",
- "post_status" =>"publish",
- "hidden_post_visibility"=>"public",
- "visibility" =>"public",
- "EventAllDay" =>"yes",
- "EventStartDate" =>"2012-01-01",
- "EventStartHour" =>"12",
- "EventStartMinute" =>"00",
- "EventStartMeridian" =>"am",
- "EventEndDate" =>"2012-01-03",
- "EventEndHour" =>"11",
- "EventEndMinute" =>"00",
- "EventEndMeridian" =>"pm",
- "is_recurring" =>"yes",
- "recurrence[type]" =>"Every+Month",
- "recurrence[end-type]" =>"On",
- "recurrence[end]" =>"2014-06-29",
- "recurrence[end-count]" =>"1",
- "recurrence[custom-type]" =>"Daily",
- "recurrence[custom-interval]" =>"",
- "recurrence[custom-type-text]" =>"",
- "recurrence[occurrence-count-text]" =>"month",
- "recurrence[custom-month-number]" =>"First",
- "recurrence[custom-month-day]" =>"1",
- "recurrence[custom-year-month-number]" =>"1",
- "recurrence[custom-year-month-day]" =>"1",
- "recurrence[recurrence-description]" =>"",
- "EventCost"=>"",
- "excerpt"=>""
- );
- $event_id = TribeEventsAPI::createEvent($eventSettings);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment