Subject: “Enable gallery preview” doesn’t work when “Enable image zoom” is disabled
Hi,
I think there’s an unintended dependency between two listing display settings that are presented as independent in the UI but aren’t independent in the templates:
- Listings > Display > Images > “Enable gallery preview” (hp_listing_enable_image_preview)
- Listings > Display > Images > “Enable image zoom” (hp_listing_enable_image_zoom)
Steps to reproduce:
- Enable “Enable gallery preview”, leave “Enable image zoom” disabled.
- View a listing card/grid item that has multiple images.
- Click/tap on the image to trigger the preview.
Expected: the gallery preview should cycle/open normally, since it’s controlled by its own separate option.
Actual: the preview trigger doesn’t open anything. Inspecting the DOM shows the img’s data-zoom attribute is empty when zoom is off:
With zoom disabled:
With zoom enabled:
Looking at the templates, this seems to be the cause: in listing-images.php, the data-zoom URL is only populated when hp_listing_enable_image_zoom is on:
if ( get_option( ‘hp_listing_enable_image_zoom’ ) ) :
$image_urls = $listing->get_images__url( ‘large’ );
endif;
Meanwhile in listing-image.php, the gallery preview toggling (hp_listing_enable_image_preview) is a completely separate condition that doesn’t check the zoom option at all. So the preview trigger renders fine either way, but the front-end component that opens on click apparently relies on data-zoom being populated to know what to display — meaning gallery preview effectively can’t function with zoom disabled, even though the two settings look independent in the admin UI.
Is this expected behavior? If so, it’d be worth noting the dependency in the settings UI (e.g. disable/grey out or note under “Enable gallery preview” that it requires zoom to be enabled). If not, happy to provide more details/version info if useful for a fix.
Thanks!