"Enable gallery preview" doesn't work when "Enable image zoom" is disabled

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:

  1. Enable “Enable gallery preview”, leave “Enable image zoom” disabled.
  2. View a listing card/grid item that has multiple images.
  3. 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!

Hi,

Thanks for the details.

I’d like to clarify what the Enable gallery preview option is intended to do.

When this option is enabled, listings with multiple images should display arrows that allow users to preview the other images directly from the listing block, without having to open the listing page.

I’ve tested this locally with Enable gallery preview enabled and zoom disabled, and everything works as expected, I’m able to preview the other listing images directly from the listing block: Images settings for listings | Loom

Regarding the Zoom option, this feature is available on the individual listing page and allows users to zoom in on images from the listing gallery.
.

If this is not the behavior you’re experiencing on your website, could you please record a short screencast showing the actual behavior? This will help us better understand the issue.

Additionally, have you tried temporarily disabling customizations and third-party plugins to rule out any conflicts?

Thanks for the clarification and the Loom — that makes sense. I was conflating the two features (thought “gallery preview” controlled the lightbox on the listing detail page). Testing again with that distinction in mind, everything behaves as expected. Sorry for the noise, and thanks for the quick response!

1 Like

Glad to help!

Wishing you a lovely day. :herb:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.