Skip to main content

Elementor — Unit gallery dynamic tag

Booking Engine Connector registers an Elementor dynamic tag that feeds Gallery and Media Carousel (and other gallery-category controls) from the same bec_core_gallery meta as sync and the [bec_unit_gallery] shortcode.


Requirements

  • Elementor (free or Pro) with dynamic tags enabled.
  • Unit posts synced with gallery attachment IDs in bec_core_gallery.
  • For loop templates, each item should be a bec_unit post (or set Unit ID explicitly).

Setup

  1. Edit a page or Elementor template (single unit, archive loop item, etc.).
  2. Add a Gallery or Media Carousel widget (or any widget whose gallery control supports dynamic data).
  3. Open the gallery control → dynamic icon.
  4. Choose Booking Engine → Unit gallery.

Elementor Unit gallery dynamic tag


Tag controls

ControlDefaultMeaning
Image limit6Maximum images after offset. 0 = entire gallery.
Offset0Skip the first N images in stored gallery order.
Unit ID(empty)Target Units post ID. Leave empty to use the current post (single unit page or Loop Grid item).

Elementor resolves attachment IDs from the Media Library (URLs come from WordPress, not a JSON shortcode).


Behaviour notes

SituationWhat happens
Current post is a bec_unitGallery uses that unit’s bec_core_gallery order.
Unit ID setAlways uses that unit, even outside the unit loop.
No images / invalid unitWidget shows empty gallery (Elementor’s own empty state).
Same data as [bec_unit_gallery]Yes — shared UnitGalleryPresenter; shortcode outputs JSON URLs, tag outputs native attachment rows.

Developer hooks

FilterPurpose
bec_unit_gallery_elementor_rowsAdjust { id: attachmentId } rows before Elementor consumes them.
bec_unit_gallery_elementor_valueFinal tag value ($rows, $postId, $settings).

Attachment ID list is also filterable via bec_unit_gallery_attachment_ids (see bec_unit_gallery).