Skip to content

Gallery Library: Customising

The shared gallery library (\ImmoMakler\Frontend\Gallery\) can be customised in two ways without modifying the plugin code:

  1. Filter hooks — modify the image selection, the options array, or the lightbox configuration at runtime.
  2. CSS variables — override colours, spacing, and control sizes per gallery instance.

Modifies the resolved image collection before rendering. Applies uniformly across all usage contexts: Divi module, Bricks tag, shortcode, and the legacy skin templates.

Signature:

apply_filters(
'immomakler_gallery_image_collection',
\ImmoMakler\Frontend\Gallery\Image_Collection $collection,
int $post_id,
string $source // 'all' | 'floorplans' | 'non_floorplans'
)

Example — reverse image order:

add_filter(
'immomakler_gallery_image_collection',
function ( $collection, $post_id, $source ) {
if ( ! $collection instanceof \ImmoMakler\Frontend\Gallery\Image_Collection ) {
return $collection;
}
$reversed = array_reverse( $collection->all() );
return new \ImmoMakler\Frontend\Gallery\Image_Collection( $reversed );
},
10,
3
);

Modifies the options array passed to the preset after caller values have been merged with the preset defaults. Suitable for centrally enforcing options such as loop, autoplay, or space_between.

Signature:

apply_filters(
'immomakler_gallery_options',
array $options,
string $preset_id,
int $post_id,
string $source
)

Example — enable autoplay for all carousel presets:

add_filter(
'immomakler_gallery_options',
function ( $options, $preset_id, $post_id, $source ) {
if ( in_array( $preset_id, [ 'horizontal_thumbs', 'vertical_thumbs' ], true ) ) {
$options['autoplay'] = true;
}
return $options;
},
10,
4
);

Example — disable arrow key navigation:

By default, the slideshow presets can be operated with the arrow keys (as well as Page Up / Page Down) as soon as the gallery is within the visible area. When the lightbox is open, the arrow keys control only the lightbox. The keyboard option switches off keyboard navigation:

add_filter(
'immomakler_gallery_options',
function ( $options, $preset_id, $post_id, $source ) {
$options['keyboard'] = false;
return $options;
},
10,
4
);

Modifies the options passed to lightGallery() in the browser — e.g. plugins, speed, licenseKey, strings. Applies to both the new gallery library and the legacy skin templates (this is the same filter that the old Lightgallery class has provided for years).

Signature:

apply_filters( 'immomakler_lightgallery_options', array $options )

Example — enable the download button:

add_filter(
'immomakler_lightgallery_options',
function ( $options ) {
$options['download'] = true;
return $options;
}
);

The plugins key contains the list of active lightGallery plugins. WP-ImmoMakler ships a ready-made script for all lightGallery plugins. You do not need to enqueue the respective script yourself via wp_enqueue_script() — simply add the appropriate token to plugins:

TokenPluginActive by default
lgZoomZoom✓
lgThumbnailThumbnails✓
lgFullscreenFull screen✓
lgAutoplayAutoplay (Slideshow)—
lgMediumZoomMedium Zoom—
lgRotateRotate / Flip—
lgShareShare (Social Media)—
lgHashDeep-linking via URL hash—
lgPagerPage dots (Pager)—
lgCommentComments—
lgRelativeCaptionRelative caption—
lgVideoVideo (YouTube, Vimeo, HTML5)—
lgVimeoThumbnailVimeo thumbnails (requires lgVideo)—

WP-ImmoMakler automatically loads exactly the JavaScript files corresponding to the tokens actually listed in plugins: adding a token loads the matching plugin script; removing one omits the script.

Example — enable autoplay (Slideshow):

add_filter(
'immomakler_lightgallery_options',
function ( $options ) {
$options['plugins'][] = 'lgAutoplay'; // Activate autoplay plugin
$options['slideShowAutoplay'] = true; // Start slideshow automatically on open
$options['slideShowInterval'] = 1500; // Time between images (in ms)
$options['progressBar'] = true; // Show progress bar
return $options;
}
);

Simply adding lgAutoplay shows the play/pause button in the lightbox toolbar; slideShowAutoplay additionally starts playback automatically on open. The complete list of autoplay options (slideShowAutoplay, slideShowInterval, progressBar, forceSlideShowAutoplay, autoplayControls) can be found in the lightGallery documentation.

Section titled “Filter: extending the Static gallery controls area”

The Static gallery renders a controls area in the bottom-right corner (.immomakler-gallery__controls), which by default contains the “Show all N photos” pill button (when not all photos fit in the thumbnail grid and the Customiser option When there are more photos than thumbnail slots is set to “Button”).

The filter immomakler_gallery_static_controls_items allows arbitrary additional actions to be inserted — typically anchor links to floor plan, video, or virtual tour sections of the detail page.

Signature:

apply_filters(
'immomakler_gallery_static_controls_items',
array $items,
\ImmoMakler\Frontend\Gallery\Image_Collection $images,
int $post_id
)

Each item is an associative array with the following fields:

FieldRequiredDescription
modifier✓BEM modifier suffix for the CSS class (e.g. floorplan → .immomakler-gallery__controls-item--floorplan).
href✓Anchor target: # for a lightbox trigger, #section-id for an internal link.
label✓Visible, translated text.
data_attributesoptionalattr-name => value pairs, rendered as data-<name>="<value>". Use immomakler-gallery-lightbox-index to wire up a lightbox trigger.
aria_labeloptionalScreen reader text (overrides the visible label).
icon_svgoptionalRaw SVG markup. Output in a __controls-item-icon span before the label.

Example — add a “Show floor plan” link when a floor plan anchor exists on the page:

add_filter(
'immomakler_gallery_static_controls_items',
function ( array $items, $images, int $post_id ): array {
if ( ! has_floorplan( $post_id ) ) {
return $items;
}
$items[] = [
'modifier' => 'floorplan',
'href' => '#grundriss',
'label' => __( 'Grundriss anzeigen', 'mein-theme' ),
'icon_svg' => '<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="..."/></svg>',
];
return $items;
},
10,
3
);

The slideshow presets run on Swiper. WP-ImmoMakler does not ship the complete Swiper build, only the core plus these modules:

ModulePurpose
NavigationArrow buttons
PaginationImage counter (e.g. “3 / 20”)
A11yScreen reader labels
ThumbsThumbnail strip
AutoplayAutomatic image changes
EffectFade“Fade” transition effect
KeyboardArrow key navigation
ManipulationAdding images at runtime

Custom presets that you register via the immomakler_gallery_register_presets action can only use these modules. Swiper options from other modules, such as effect: 'coverflow' or mousewheel, have no effect.

WP-ImmoMakler’s copy of Swiper is available at window.immomakler.Swiper and does not occupy the global window.Swiper variable. This keeps other plugins that ship their own Swiper — such as Elementor Pro — from conflicting with WP-ImmoMakler.

The built-in presets use CSS custom properties on the wrapper class .immomakler-gallery. This allows you to override colours, spacing, and control sizes per gallery instance or globally — without writing high-specificity selectors.

VariableDefaultDescription
--immomakler-gallery-primary-color#af1615Accent colour (arrows, active thumbnail, lightbox controls).
--immomakler-gallery-primary-color-inverted#fffContrast colour for the accent colour (e.g. arrow icon on a coloured button).
--immomakler-gallery-main-aspect4 / 3Aspect ratio of the main image.
--immomakler-gallery-thumb-aspect3 / 2 (vertical) / 4 / 3 (horizontal)Aspect ratio of the thumbnails.
--immomakler-gallery-gap8px (horizontal) / 10px (vertical)Spacing between images. Applies to both the CSS grid gap of the thumbnail strip and Swiper’s spaceBetween — the loader reads the computed variable at initialisation time so that custom CSS overrides (e.g. responsive media queries) keep the gap between thumbnails consistent.
--immomakler-gallery-thumbs-width200px (vertical)Width of the thumbnail strip in the vertical layout.
--immomakler-gallery-nav-button-size30pxSize of the arrow buttons.
--immomakler-gallery-nav-opacity0.8Opacity of the main image arrows (at rest).
--immomakler-gallery-thumb-default-opacity0.6Opacity of inactive thumbnails.
--immomakler-gallery-thumb-nav-opacity0.5Opacity of the thumbnail strip arrows (vertical layout).
--immomakler-gallery-thumb-nav-height20pxHeight of the thumbnail strip arrow buttons (vertical layout).
--immomakler-gallery-carousel-height400pxHeight of the gallery in carousel layout.
--immomakler-gallery-slide-background#fffBackground behind the images for the “Fade” and “Aus- und Einblenden” transition effects. Only visible behind images with transparent areas, such as floor plans saved as PNG. On dark sites, set it to the page’s background colour, for example.

Example — set accent colour and main image ratio globally:

.immomakler-gallery {
--immomakler-gallery-primary-color: #1a73e8;
--immomakler-gallery-primary-color-inverted: #ffffff;
--immomakler-gallery-main-aspect: 16 / 9;
}