Digital Sovereignty for everyone

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_.

  • lh_image_gallery_is_indexable: whether a photo page may be indexed. Receives the default (true when the photo has a caption or alt text), the attachment ID and the post.
  • lh_image_gallery_return_endpoint: the endpoint, photo by default. Change it if a page has a child page with that slug.
  • lh_image_gallery_return_anchor: the fragment links to photo pages end with and the photo block’s id, photo by default. Return an empty string to link without one.
  • lh_image_gallery_return_linked_destinations: which image link settings get a photo page, media and attachment by default.
  • lh_image_gallery_return_template_content: the block markup of the registered template.
  • lh_image_gallery_return_template_slug and lh_image_gallery_return_block_name: the template slug and the block name.
  • lh_image_gallery_return_cache_version and lh_image_gallery_return_rewrite_schema: bump to rebuild every cached gallery list, or to flush rewrite rules once on every site.
  • lh_image_gallery_init_plugin: return false to switch the plugin off without deactivating it.

If you like this plugin please consider making a donation to further development

Install LHero.org

lhero.org

Open it straight from your home screen, full screen and quicker to load.

  1. Tap the Share button . If you cannot see it, tap ••• first.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add.
  1. Tap the browser menu â‹®.
  2. Tap Install app or Add to Home screen.
  1. In the menu bar, choose File, then Add to Dock.

Use your browser's menu to install this site or add it to your home screen.