Menu
All plugins

Adaptive Gallery for Bricks — v1.3.1

Open the live demo

A native custom Bricks element with a height-limited vertical thumbnail rail. If all thumbnails fit, they appear normally. If there are more images than slots, the last slot becomes a +N button opening the *whole* gallery, not just its remaining photos.

Requirements

WordPress with Bricks Builder, PHP 7.4 or later, and local WordPress image attachments. ACF Pro is required for ACF Gallery fields; WooCommerce product galleries require WooCommerce and a product context. Neither is required for Media Library galleries.

Install

1. WordPress → Plugins → Add New → Upload Plugin → select the ZIP.
2. Activate the plugin while Bricks Builder is active.
3. Edit a page in Bricks. Find Adaptive Gallery under Media.
4. Under Content, pick your gallery source and configure its layout. Save and preview the frontend.

Gallery image sources

– Media Library: the native Bricks image-gallery chooser. You can select/reorder images. A dynamic gallery value may also be entered via supported Bricks dynamic controls.
– ACF Gallery: provide the exact ACF field name, select current post or ACF options. ACF continues to own the original data.
– Bricks dynamic tag: enter a dynamic tag that resolves to attachment IDs (for example {acf_my_gallery}). Bricks provider compatibility can vary with field providers and versions.
– Custom field: reads a post-meta value containing attachment IDs, a comma-separated list, or a PHP/JSON array of attachment IDs. Useful with Meta Box / JetEngine *when their meta values have these formats*. It is not a generic parser for all plugin-specific data structures.
– WooCommerce: product featured image followed by _product_image_gallery attachments in product order.
– Attached images: WordPress image attachments with the current post as parent.

For an ACF Gallery, use the dedicated ACF option for predictable field behaviour. The gallery expects local WordPress attachment IDs; externally hosted URL-only image sources are not supported.

Bricks breakpoints (including custom breakpoints)

Use Content → Layout at this breakpoint. Select a breakpoint in the native Bricks toolbar and choose Vertical thumbnails, Horizontal thumbnails, Swipe gallery + dots, or Main image only. The control emits --nlag-layout using Bricks responsive CSS; no hardcoded tablet/mobile breakpoints are applied. The chosen mode updates as Bricks CSS changes, including custom breakpoint widths and mobile-first configurations. The gallery uses ResizeObserver and resize events to recalculate its height-aware rail after a breakpoint switch. If no responsive overrides are set, the base layout is vertical.

All sizing controls (thumbnail width/height/gaps, rail spacing, viewport maximum height, corner radii, aspect ratio, object-fit and rail placement) emit native responsive CSS properties, as do the appearance controls in the Style tab. You may override them with Bricks element/class styling or theme variables.

Upgrade note: v1.0.0 had separate fixed-width Desktop/Tablet/Mobile selectors. v1.1.0 replaces those with a single truly breakpoint-aware control. Reconfigure the layout at each desired breakpoint after upgrading existing instances.

Style controls

In the Bricks element Style tab you can change stage background, thumbnail backgrounds/borders, active/hover colours, overflow overlay colour/opacity, label colour and size, thumbnail border width and hover enlargement, image arrows and their size/inset, counter and captions, dots, and the lightbox background/text/thumbnail sizing and image fit. Colour/size settings are scoped to the individual element and responsive where Bricks supports it.

A true simultaneous opacity crossfade now overlaps incoming and outgoing images in the reserved image viewport. Crossfade duration is configurable in Content. Reduced-motion preferences disable animations. All image layers keep a fixed stage height during transitions.

Calculation

capacity = floor((stageHeight + gap) / (thumbnailHeight + gap)).

When image count exceeds capacity, display capacity - 1 photos and a final gallery lightbox trigger. One-slot capacity renders the trigger alone. With zero capacity the rail is empty; the main image remains usable.

Accessibility / features

– Buttons and visible focus rings, Escape close, arrow navigation, focus return and trap, swipe navigation, page scroll lock, reduced-motion.
– Lightbox with all photographs, full-resolution original, thumbnail strip, caption and image count.
– WordPress attachment image sizes and responsive image srcset, non-active image lazy loading.
– Multiple gallery instances, ResizeObserver, Bricks Ajax re-initialisation and mutation handling for inserted gallery elements.

Important limitations

– Gallery sources containing URL-only images, proprietary non-ID field formats or remote assets require a custom adapter.
– The supplied archive records PHP lint, JavaScript syntax and standalone Chromium layout checks. Those checks do not establish live Bricks editor, ACF, WooCommerce, browser or accessibility compatibility. Playground results must be recorded separately before making broader integration claims.
– Plugin frontend assets are loaded site-wide to guarantee first-paint styles even where Bricks renders gallery content late; conditional page-specific enqueuing is a possible enhancement.

Acceptance testing

Check empty/single/multi-image galleries, capacity = 1, exact capacity and overflow, narrow containers, tabs/accordions, multiple instances, keyboard and swipe controls, ACF post and options fields, WooCommerce products, dynamic tags, mobile and resizing. Use a staging site with real wildlife images to check image display and CSS interactions with your Bricks theme.

### Thumbnail capacity and overflow guarantees (v1.2)

The gallery measures the rendered image stage and allocates thumbnail slots based on the active Bricks CSS variables. When not all images are represented in the rail, the final slot is always the lightbox action: it is never deleted by the fit correction. If the rail is shorter than one configured thumbnail, the action is sized down to fit the available stage dimension. Changes to the root element's class/style attributes recalculate the rail even when its width and height are unchanged.

Automated layout checks were run in Chromium against the standalone demonstration and the frontend gallery controller. They do not replace real Bricks editor, ACF or WordPress integration tests.

### Gallery presentation (v1.3)

3:2 is the default, not a constraint. Content → Image aspect ratio offers 3:2, 4:3, 1:1, 16:9, 2:1, 5:4, 3:4, 2:3, and Natural. Fixed ratios keep the stage stable when the source gallery mixes portrait & landscape; Natural deliberately changes stage dimensions on selection (therefore recalc of thumbnail capacity may be visible). The demo's Natural mode uses illustrative mixed aspect ratios; the plugin reads intrinsic image dimensions.

Mobile gallery defaults to swipe + pagination dots below 767px. The native responsive layout control can be applied at Bricks custom breakpoints. Make the same selections in the active custom breakpoint to override the default fallback.

The Style tab now provides lightbox active thumbnail colour, control backgrounds & sizing, backdrop blur, thumbnail corner radius and image hover zoom. Motion is disabled when the visitor prefers reduced motion.

Playground demonstration coverage

The demo should pair each example with its Bricks settings and an observable result:

Example: Settings / source · What to check

Responsive gallery: Vertical base, horizontal tablet, dots phone · Resize across the active Bricks breakpoints; selected image remains usable

Overflow rail: Many images and a limited stage height · Final slot opens every image; +N counts images missing from the rail

One-slot rail: Stage shorter than two thumbnails · A single overflow action fits and opens the full gallery

Four layouts: Vertical, horizontal, dots, main image only · Each layout has independent navigation and selection

Mixed aspect ratios: Fixed 3:2, portrait, square and Natural · Fixed stage stays stable; Natural follows image dimensions

Appearance: Right rail, cover/contain, captions, counter, arrows, dots, zoom · Each setting affects only its own instance

Image sources: Media, ACF post/options, dynamic tag, custom field, product, attachments · Image IDs and order agree with the source records

Empty and single image: Zero or one attachment · No broken image, invalid counter or inaccessible action

Lightbox: Click stage or +N · All photos, caption, count, thumbnails, Escape, arrows, focus return

ACF Pro and WooCommerce examples depend on those plugins being available. An unavailable integration must be labelled pending, never replaced with a Media Library gallery presented as proof of that source.

Troubleshooting

– Empty output: verify attachment IDs and source context. Empty galleries intentionally render no frontend markup.
– Wrong layout: check the active Bricks breakpoint and any inherited class settings. The stylesheet has a phone fallback below 767px; explicit responsive element values override it.
– Unexpected crop: use Contain, or choose Natural if the stage should follow each image.
– Missing thumbnails: inspect the stage height, thumbnail height and gap; overflow is intentional.
– ACF options: use the dedicated ACF source and options scope; the implementation reads the shared option storage bucket.

Documentation maintenance

This README describes 1.3.1. Earlier version notes above explain upgrades; they are not separate installation targets. Preserve the original archive and record live test evidence alongside any revised package.

1.3.1 Playground correction

Live Bricks testing found numeric CSS custom properties were emitted without length units because Bricks ignores the supplied suffix key. Length controls now use %spx in their CSS value template; percentage scale values remain unitless. This restores thumbnail size, gaps, maximum stage height, radius and other sizing controls. The supplied 1.3.0 archive is preserved separately.

Live Playground examples — 23 October 2026

Demo: https://bricks-playground.co.uk/adaptive-gallery-demo/

Guide: https://bricks-playground.co.uk/docs/adaptive-gallery/

The live page contains 25 examples using native Bricks elements or loops and isolated WordPress/ACF fixtures. Browser evidence and the precise verification boundary are recorded in docs/verification/bricks-new-plugins-2026-10-23/VERIFICATION.md in the working repository. These examples do not certify production accessibility, scale or all-browser compatibility.