divide custom field values in div every two values
i have this html mark-up to sort some data
div class="row"
div class="col-xs-2"
img src="images/member-schools/ms1.jpg" class="img-responsive"
/div
div class="col-xs-4"
h4American International School - East/h4
/div
div class="col-xs-2"
img src="images/member-schools/ms2.jpg" class="img-responsive"
/div
div class="col-xs-4"
h4Dover American International School/h4
/div
and i am pulling out the data from repeatable group metabox i use from CMB2
this is the code for the registered metabox
function schools() {
// Start with an underscore to hide fields from custom fields list
$prefix = 'schools_';
/**
* Repeatable Field Groups
*/
$schools= new_cmb2_box( array(
'id' = $prefix . 'metabox',
'title' = __( 'schools', 'cmb2' ),
'object_types' = array( 'page', ),
'show_on' = array( 'key' = 'id', 'value' = 6 ),
'closed' = true,
) );
$group_field_id = $schools-add_field( array(
'id' = $prefix . 'field',
'type' = 'group',
'options' = array(
'group_title' = __( 'Slide {#}', 'cmb2' ), // {#} gets replaced by row number
'add_button' = __( 'Add Another Slide', 'cmb2' ),
'remove_button' = __( 'Remove Slide', 'cmb2' ),
'sortable' = true, // beta
),
) );
$schools-add_group_field( $group_field_id, array(
'name' = __( 'Photo', 'cmb2' ),
'id' = 'photo',
'type' = 'file',
) );
$schools-add_group_field( $group_field_id, array(
'name' = __( 'Name', 'cmb2' ),
'id' = 'name',
'type' = 'text',
) );}
i pull the data out through this code
$schools = get_post_meta( get_the_ID(), 'schools_field', true );
where $schools is an array that contain an image and title for each entry which i can loop through to pull out the values.
my question is how i can add div class="row"
every two items from that array , because i need a row for each two entries
EDIT: var_dump result
array(3) {
[0] = array(3) {
["photo_id"] = string(2) "89"
["photo"] = string(56) "http://localhost/NCSR/wp-content/uploads/2015/06/ms3.jpg"
["name"] = string(8) "School 1"
}
[1] = array(3) {
["photo_id"] = string(2) "88"
["photo"] = string(56) "http://localhost/NCSR/wp-content/uploads/2015/06/ms2.jpg"
["name"] = string(8) "school 2"
}
[2] = array(3) {
["photo_id"] = string(2) "87"
["photo"] = string(56) "http://localhost/NCSR/wp-content/uploads/2015/06/ms1.jpg"
["name"] = string(8) "school 3"
}
}