Skip to content

How to Create WordPress Image Gallery with Custom Unique Link to Each Image?

Key Takeaways

  • Nexter Blocks Media Listing block adds a custom link to each image in a WordPress photo gallery.
  • Repeater in the Content tab uses the Links field for URLs, and the Links option is only available for Repeater.
  • Box Link and Force Custom URL in the Extra Options tab make the entire image clickable with a custom link.
Table of Contents

A portfolio grid is only useful if each photo leads to the project behind it.

The Media Listing block can give every item its own link, so clicking a tile opens that page instead of the lightbox.

For every Media Listing setting in one place, see the Media Listing block guide.

Before You Start

  • Edition: Pro — the Media Listing block is part of Nexter Blocks Pro.
  • Block to enable: Media Listing, switched on under Nexter > Blocks in your WordPress dashboard.
  • Your images uploaded: add them to the Media Library first so you can pick them straight from the block.

Steps

  1. Add the Media Listing block to your page and click Design from Scratch.
  1. In the Layout panel, set Type to Images.
The Layout panel with the Type setting set to Images
  1. Open the Content panel and set Select Option to Repeater.
The Content panel set to Repeater with the Title field for one item
  1. Click + Add Item for each photo, then set its Image, Title and Caption.
  1. Fill in the Link field on each item with the page it should open.
The Link field on a repeater item
  1. Back in Layout, set Popup Layout to No so the lightbox stops taking the click.
The Popup Layout setting set to No
  1. Open Extra Options and switch Box Link on so the whole tile is clickable.
The Box Link setting in Extra Options
  1. Switch Force Custom URL on so the item’s own link is used, then publish.
The Force Custom URL setting in Extra Options
A gallery where each photo links to its own page

All Three Settings Are Needed

SettingWhereWhy it matters
Popup Layout = NoLayoutWhile the lightbox is on it intercepts the click and the link never runs
Box Link = onExtra OptionsMakes the whole tile clickable rather than just the title
Force Custom URL = onExtra OptionsUses the Link you typed on the item instead of the image file

How It Behaves

  • Each tile links to the address on its own repeater item, and items with an empty link stay unclickable.
  • With all three settings in place the gallery has no lightbox triggers left at all.
  • Links can point anywhere, including other sites, and each item keeps its own open in a new tab setting.
  • Leaving any one of the three off falls back to the previous behaviour, usually the lightbox.

Limitations

  • Pro only.
  • Links need Repeater content. Images picked under Normal have no link field.
  • You cannot have the lightbox and custom links at the same time. It is one or the other per gallery.
  • Links are typed per item, so a changed URL has to be updated on every item that uses it.

Troubleshooting

Clicking a photo still opens the lightbox

Popup Layout is still on Default. Set it to No.

Clicking opens the image file instead of my page

Switch Force Custom URL on in Extra Options.

Only the title is clickable

Switch Box Link on so the click area covers the whole tile.

Related Docs

Share your Thoughts

Still in Doubt? Let’s Assist You

Have Feedback or Questions?

Join our WordPress Community on Facebook!