Hello
I am trying to output following custom image fields inside a clonable group in my theme. I am using this code from your documentation. The text fields are displayed but not the image.
This are my custom fields:
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
function your_prefix_register_meta_boxes( $meta_boxes ) {
$meta_boxes[] = array (
'title' => 'Gallerie',
'id' => 'gallerie',
'post_types' => array(
0 => 'exhibitions',
),
'context' => 'normal',
'priority' => 'high',
'fields' => array(
array (
'id' => 'exhb_gallery_group',
'type' => 'group',
'name' => 'Bilder',
'fields' => array(
array (
'id' => 'exhb_gallery',
'type' => 'single_image',
'name' => 'Einzelbild',
),
array (
'id' => 'exhb_gallery_description',
'name' => 'Bildunterschrift',
'type' => 'wysiwyg',
'options' => array(
'textarea_rows' => 2,
'media_buttons' => false,
'teeny' => true,
),
),
),
'clone' => 1,
'sort_clone' => 1,
'default_state' => 'expanded',
),
),
);
return $meta_boxes;
}
This is my template code:
// Group is cloneable
$group_values = rwmb_meta( 'exhb_gallery_group' );
//print_r($group_values);
if ( ! empty( $group_values ) ) {
foreach ( $group_values as $group_value ) {
$image_ids = isset( $group_values['exhb_gallery'] ) ? $group_values['exhb_gallery'] : array();
foreach ( $image_ids as $image_id ) {
$image = RWMB_Image_Field::file_info( $image_id, array( 'size' => 'large' ) );
echo '<img src="' . $image['url'] . '" width="' . $image['width'] . '" height="' . $image['height'] . '">';
}
echo '', $group_value['exhb_gallery_description'], '
';
}
}
Thank you for your efforts!
Lukas