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_unitpost (or set Unit ID explicitly).
Setup
- Edit a page or Elementor template (single unit, archive loop item, etc.).
- Add a Gallery or Media Carousel widget (or any widget whose gallery control supports dynamic data).
- Open the gallery control → dynamic icon.
- Choose Booking Engine → Unit gallery.
Tag controls
| Control | Default | Meaning |
|---|---|---|
| Image limit | 6 | Maximum images after offset. 0 = entire gallery. |
| Offset | 0 | Skip 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
| Situation | What happens |
|---|---|
Current post is a bec_unit | Gallery uses that unit’s bec_core_gallery order. |
| Unit ID set | Always uses that unit, even outside the unit loop. |
| No images / invalid unit | Widget 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
| Filter | Purpose |
|---|---|
bec_unit_gallery_elementor_rows | Adjust { id: attachmentId } rows before Elementor consumes them. |
bec_unit_gallery_elementor_value | Final tag value ($rows, $postId, $settings). |
Attachment ID list is also filterable via bec_unit_gallery_attachment_ids (see bec_unit_gallery).
Related
- Elementor — hide units with no availability — Loop Grid Query ID
bec_available_only - bec_unit_gallery — JSON output for custom JS
- Gallery images