Create a reusable gallery page layout with the WordPress block editor (Gutenberg). By adding the ShutterPress Gallery block and selecting Use Post Gallery, you can use one layout for multiple galleries while each gallery displays its own images.
Before you begin
- Install and activate ShutterPress Gallery, and create a gallery containing images. Having two galleries makes it easier to check that the template is dynamic.
- Use a block theme with access to Appearance → Editor for the Site Editor workflow below. If this menu is unavailable, see the troubleshooting section.
- Make sure your WordPress account can edit templates.
Understand the two types of template
A Gutenberg page template controls the surrounding page layout: for example, the header, gallery title, spacing and footer.
A ShutterPress Gallery Template, managed under ShutterPress → Gallery Templates, controls gallery presentation such as icons, hover effects and lightbox styling. Choose it in the gallery’s Gallery Template setting. See Gallery Templates for those options.
This guide covers the Gutenberg page template. You can use it alongside your ShutterPress Gallery Template.
1. Create a single gallery template
- In WordPress, open Appearance → Editor → Templates.
- Choose Add Template and select the single-item template option for the ShutterPress gallery post type. The wording can vary by WordPress version.
- Choose whether the template should apply to all galleries or a specific gallery, where offered. To reuse the layout across your galleries, choose all galleries.
- Start with an available layout or a blank template. Keep or add the header and footer you want to use.
If a single gallery template already exists, open it to edit its layout. Changes to a shared template affect the galleries that use it.
2. Add the gallery block
- Add a Group block if you want to control the gallery area’s width and spacing.
- Optionally add a Post Title block above the gallery so the heading uses the current gallery’s title.
- Click +, search for ShutterPress Gallery and insert the block.
- Select the block and open its settings sidebar. Under Select Gallery, choose Use Post Gallery. This is a dropdown choice, rather than a separate switch.
- Use the ShutterPress block as the gallery output in this layout. If the starting template contains a Post Content block that also outputs the gallery, remove that duplicate output from this gallery template.
Use Post Gallery tells the block to display the gallery belonging to the current gallery page. Selecting a named gallery instead fixes the block to that gallery, so other gallery pages using the template would show the same images.
In the editor, you may see “ShutterPress Gallery. View the post to see images.” This placeholder is expected when Use Post Gallery is selected. Check the result on an actual gallery page.
3. Configure the block
Open the block’s Gallery Settings to configure its layout:
- Layout: choose Grid, Masonry or Justified.
- Image Gap: set the spacing between images.
- Columns: for Grid and Masonry, set desktop, tablet and mobile columns separately.
- Row Height: for Justified, set the target row height.
- Use Lightbox: choose whether images open in the lightbox.
- Use Default Buttons: keep this enabled if you want the gallery’s built-in controls.
For example, start with a Grid layout using three desktop columns, two tablet columns and one mobile column. Adjust the image gap to suit your page. These are example choices, not required settings.
The block supplies its own layout controls, so check these when the result differs from your ShutterPress Gallery Template. Available actions still depend on the gallery’s settings and the visitor’s access. For more block options, see Gutenberg Block.
4. Save and test
- Save the template and review the changes listed in the save panel.
- Open a gallery’s public page or authorised preview. Confirm that its title and images are correct.
- Open a second gallery using the same template. Confirm that it shows its own images.
- Check desktop, tablet and mobile widths, then test the lightbox and any enabled gallery controls.
Use more than one gallery page template
You can create multiple Gutenberg gallery page templates, for example separate layouts for wedding and portrait galleries. Where your theme and gallery editor provide WordPress’s Template selector, choose the appropriate custom template manually for each gallery.
- Create the custom layouts and make them available for the ShutterPress gallery post type. Keep Use Post Gallery selected in each layout’s ShutterPress Gallery block.
- Open the gallery you want to change and find WordPress’s Template setting, where available.
- Select the appropriate custom page template, save or update the gallery, and check its page.
This WordPress Template setting is separate from ShutterPress’s Gallery Template setting, which controls the gallery’s presentation rather than the surrounding page layout. If the WordPress Template selector is unavailable, manual assignment through this control is not supported by your current theme and editor setup; a template targeting a specific gallery is another option in the Site Editor.
Gutenberg does not provide Elementor-style display conditions to select an individual gallery’s page template automatically by gallery category. That requires additional plugin support or custom code. A category archive template controls the page listing galleries in that category, rather than each gallery’s own page.
Troubleshooting
- Appearance → Editor is missing: the Site Editor workflow requires a block theme. A classic theme may offer limited template editing if it explicitly supports it. You can still embed a named gallery in a normal Gutenberg page using the ShutterPress Gallery block.
- No gallery choice appears: confirm that at least one ShutterPress gallery exists and allow the gallery list to load.
- Every page shows the same images: change Select Gallery from a named gallery to Use Post Gallery.
- No images appear on the website: check that you are viewing a ShutterPress gallery page with images. Use Post Gallery needs a gallery context; on a normal page, select a named gallery instead.
- The gallery appears twice: check the template for both a ShutterPress Gallery block and a Post Content block that outputs the gallery.
- The new layout is not used: check the template’s scope and whether a more specific template applies to that gallery.
For more about WordPress template access and scope, see the WordPress Template Editor guide.