Themes and customising

Block themes

The plugin registers a Gallery Photo block template (WordPress 6.7+). It uses the theme’s header and footer template parts around the Gallery Photo block, which is full width with no space above it. A version edited in the Site Editor comes first, then a theme’s own template with the slug lh-image-gallery-photo, then the plugin’s. The template is never offered in the editor’s Template control.

The Gallery Photo block is server-rendered and hidden from the inserter, because it only makes sense on a photo page. It shows the photo edge to edge, at most as tall as the screen, then its caption, Previous and Next links, a link back to the post and a View full size link. The text stays inset by --lh-image-gallery-gutter (default 5%). Its page heading is the photo’s label (caption, alt text or “Photo n of N”), hidden on screen but there for screen readers and search engines. Its styles set layout only; colours and type come from the theme.

The block has the id photo, and every link to a photo page (gallery links, Previous and Next, the prerendered next page, old lh-image-url redirects) ends in #photo, so the page opens with the photo at the top of the screen. Canonical, Open Graph and structured data URLs leave it off. A theme with a sticky header can keep it clear of the photo by setting the --lh-image-gallery-scroll-margin CSS custom property (default 0).

Classic themes

A classic theme shows the photo in place of the post content in its normal single template. A theme can supply its own lh-image-gallery-photo.php.

Filters

All filter names start with lh_image_gallery_.