In the example link you mentioned, it assumes you are using the post generation features that are built into Gravity Forms. I imagine you’ll want to bypass that if you are trying to create more than one post object per form submission. In the gform_after_submission
hook, I’d do something a bit like this…
// add the new post EVENT
$event_post_args = array(
'comment_status' => 'closed', // or open
'ping_status' => 'closed',
'post_author' => 1, // this represents admin by default.
// might need to pull user info if is real user
'post_title' => $entry[1] . ' - ' . $entry[2], // note i have no clue
// what you want here
'post_status' => 'publish',
'post_type' => 'event',
);
// this returns an integer on success, 0 on failure - creates post!
$post_id = wp_insert_post( $event_post_args );
// add more meta values if you need
$event_meta_values = array(
'event_address' => $entry[3],
'event_phone' => $entry[4],
'event_something' => $entry[5],
);
// as long as wp_insert_post didnt fail...
if($post_id > 0){
foreach($event_meta_values as $key => $value) {
// add our post meta
update_post_meta($post_id, $key, $value);
}
}
// now we just do the same kind of thing for other Post Type
$club_post_args = array(
...
...
'post_title' => $entry[6],
);
// etc.
Bear in mind all of that goes in your gform_after_submission
hook, which should probably be specifically built for one particular form. You can add an underscore and the ID of the form on the hook to accomplish that: gform_after_submission_7
, for example.
You might also want some conditionals in this code to make sure those values aren’t empty before trying to make a post or post meta out of them.
Let me know if you need more explanation.