Inserting a Gallery (Shortcode)

3 min read

Updated May 23, 2026

The FotoGrids shortcode lets you embed a Gallery in any post, page, or widget area that supports shortcodes. It is the most portable way to display a Gallery — it works in the Classic Editor, in Text widgets, in page builders that pass content through WordPress’s shortcode engine, and anywhere else WordPress processes [shortcode] syntax.


Basic usage #

FotoGrids: No gallery ID specified. Usage:
FotoGrids: Gallery with ID 1 not found.

Replace 123 with the ID of the Gallery you want to display. The Gallery ID is shown in the URL when you open the Gallery editor in wp-admin (e.g. post=123), and in the ID column of the Galleries list.


Finding the Gallery ID #

Two quick ways to find a Gallery’s ID:

  • Open the Gallery in the editor — the URL in your browser contains post=123 where 123 is the ID.
  • Go to FotoGrids → Galleries in wp-admin. The ID is shown in the list table, or appears in the row’s action links when you hover over the title.

Shortcode parameters #

All parameters are optional except id. If omitted, the Gallery renders using its saved settings.

Parameterid
ValueGallery post ID (integer)
RequiredYes
Parameterlazy
Optionstrue false
Defaulttrue
Parameterlightbox
Optionstrue false
Defaulttrue
Parametercaptions
Optionstrue false
Defaulttrue

The lazy, lightbox, and captions parameters let you override those behaviours per-embed without changing the Gallery’s saved settings. This is useful when you want the same Gallery to appear differently in different contexts — for example, with the Lightbox disabled on a page where you handle clicks yourself.


Where to paste the shortcode #

Classic Editor — paste the shortcode directly into the post body in Text view, or into the Visual editor (it will remain as text and render on the frontend).

Gutenberg (Block Editor) — add a Shortcode block and paste the shortcode into it. Alternatively, use the native FotoGrids Gallery Block, which does not require copying an ID manually.

Text widgets — paste the shortcode into a Text widget in Appearance → Widgets. Make sure the widget type is Text (not Custom HTML) so WordPress processes the shortcode.

Page builders — most page builders (Elementor, Divi, Bricks) have a dedicated Shortcode element or module. Paste the shortcode there. FotoGrids Pro provides native blocks for Elementor, Divi, and Bricks that offer a visual picker instead.


Errors #

If the shortcode renders an error message rather than a Gallery, the cause is shown inline:

  • No gallery ID specified — the id parameter is missing or set to 0. Add id="123" with the correct Gallery ID.
  • Gallery not found — no Gallery exists with that ID. Double-check the ID in the Galleries list.
  • Gallery is not published — the Gallery’s post status is not publish. Open the Gallery editor and publish it.
  • Gallery has no items — the Gallery exists and is published, but contains no items. Open the Gallery editor and add items via Manage Items.

Tips #

The shortcode renders the Gallery exactly as configured in the Gallery editor. All layout, appearance, Lightbox, and sorting settings are respected — no extra configuration is needed at the shortcode level.

If you need the same Gallery on multiple pages, use the same shortcode on each. There is no limit to how many times a Gallery can be embedded.

Was this article helpful?