Yes, we looked at that but couldn’t quite get what it was on about, at the moment it uses another plugin to create the form and submit the post and it works fine, we just need to pull in more fields using CMB2, we managed to get it working correctly using the dashboard to submit the information but can’t get it on frontend. Below is the code to make it work on the backend, if you can give any pointers on how to get those fields on the front it would be much appreciated, we have access to the files but no sure how we get them all to work.
Thanks again.
add_action( 'cmb2_init', 'wp_register_repeatable_group_field_metabox' );
/**
* Hook in and add a metabox to demonstrate repeatable grouped fields
*/
function wp_register_repeatable_group_field_metabox() {
// Start with an underscore to hide fields from custom fields list
$prefix = '_wp_group_';
/**
* Repeatable Field Groups
*/
$cmb_group = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => __( 'Add Rooms', 'cmb2' ),
'object_types' => array( 'property', ),
) );
// $group_field_id is the field id string, so in this case: $prefix . 'demo'
$group_field_id = $cmb_group->add_field( array(
'id' => $prefix . 'demo',
'type' => 'group',
'description' => __( 'Please add rooms below.', 'cmb2' ),
'options' => array(
'group_title' => __( 'Room {#}', 'cmb2' ), // {#} gets replaced by row number
'add_button' => __( 'Add Another Room', 'cmb2' ),
'remove_button' => __( 'Remove Room', 'cmb2' ),
'sortable' => true, // beta
// 'closed' => true, // true to have the groups closed by default
),
// 'on_front' => true, // Optionally designate a field to wp-admin only
) );
/**
* Group fields works the same, except ids only need
* to be unique to the group. Prefix is not needed.
*
* The parent field's id needs to be passed as the first argument.
*/
$cmb_group->add_group_field( $group_field_id, array(
'name' => __( 'Room Name', 'cmb2' ),
'id' => 'room_name',
'type' => 'text',
// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
) );
$cmb_group->add_group_field( $group_field_id, array(
'name' => __( 'Room Length', 'cmb2' ),
'id' => 'room_length',
'type' => 'text',
// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
) );
$cmb_group->add_group_field( $group_field_id, array(
'name' => __( 'Room Width', 'cmb2' ),
'id' => 'room_width',
'type' => 'text',
// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
) );
$cmb_group->add_group_field( $group_field_id, array(
'name' => __( 'Description', 'cmb2' ),
'description' => __( 'Write a short description for this entry', 'cmb2' ),
'id' => 'description',
'type' => 'textarea_small',
) );
$cmb_group->add_group_field( $group_field_id, array(
'name' => __( 'Entry Image', 'cmb2' ),
'id' => 'image',
'type' => 'file',
) );
}