PUBLIC DOCUMENTATION

Fields, content types and visual FSE editing with DMBB.

← All Help Topics
HOW TO USE · VERSION 9.5.0

Gallery (Pro)

Select multiple images from the Media Library.

Screenshots and walkthrough — expand to view

Screenshots use sample data and English labels. Follow the translated instructions on this page; your theme, language, permissions and license can change the available controls. Select an image to view it at full size.

Gallery field: builder settings, storage key and validation options.
Gallery field: builder settings, storage key and validation options.
Gallery field: sample controls in the content editor.
Gallery field: sample controls in the content editor.
What it does Stores multiple attachment IDs with thumbnails.
Use it when Galleries, image collections, product images or portfolios.
How to configure Select Gallery. Editors can choose multiple Media Library images and remove individual items.
Saved as An array of attachment IDs.
EXAMPLE

Portfolio Images

[123, 145, 188]
Read a Gallery Field in PHP

Use the field Key from the builder as the second argument of get_post_meta(). Escape or sanitize the value for its final output context.

$image_ids = get_post_meta( get_the_ID(), 'your_meta_key', true );
$image_ids = is_array( $image_ids ) ? $image_ids : array();

foreach ( $image_ids as $image_id ) {
    echo wp_get_attachment_image( (int) $image_id, 'medium' );
}
Important: a Gallery field stores an array of attachment IDs. Loop through the IDs and use WordPress attachment functions to obtain the image HTML or URL. Security: Escape the value for its output context; do not print unescaped post meta directly into HTML.

Documentation for Dynamic Meta Box Builder 9.5.0.