Custom Fields
Support Meta Box Group get advanced images from array

  • Creator
  • #24172
    Resolved Martin Rybos

    Hi. I hope, it's my last support question. Easy for you difficult for me.
    How could i get images from array to lightbox

    I created an image advanced array on wordpress

        'name'             => 'Add Gallery',
        'id'               => 'gallimage',
        'type'             => 'image_advanced',
        'force_delete'     => false,
        'max_file_uploads' => 10,
        'max_status'       => 'false',
        'image_size'       => 'thumbnail',

    on frontend i need to make foreach

    $disli = $dislider['gallimage'];//array?
    foreach ( $disli as $value ) {
      echo '<a href="'.$value['full_url'].'" data-lightbox="bla"></a>';//give me error

    Thank you. Sorry, I'm not a coder just a lifetime beginner

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
  • #24173
    Long Nguyen

    Hi Martin,

    For specific field types such as media fields file, file_advanced, file_upload, image, image_advanced, image_upload, single_image, you might need to add some extra code to get the field details.

    $group = rwmb_meta( 'group_id' );
    $image_ids = $group['image_key'] ?? : [];
    foreach ( $image_ids as $image_id ) {
        $image = RWMB_Image_Field::file_info( $image_id, ['size' => 'thumbnail'] );
        echo '<img src="' . $image['url'] . '">';

    See more in the documentation

    The code to show images in your case would be:

    $disli = $dislider['gallimage'];//array?
    foreach ( $disli as $value ) {
        $image = RWMB_Image_Field::file_info( $value, ['size' => 'thumbnail'] );
        echo '<img src="' . $image['url'] . '">';
    Martin Rybos

    Ok. thanks it is working but. When i select 3 images to gallery.
    Foreach create 8 images and the last 5 images are the same.
    Do you know why ?


    This is a page
    Icon at the bttom right open lightbox.

    Long Nguyen


    I'm not sure how the script (lightbox) implements its code. Please try to contact the script support to ask for help in this case.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.