Skip to main content
Cookbook Content Envira Gallery

Make a Photo Gallery Page from Your Media Library with Envira Gallery and AI

An Envira gallery built from photos already in your media library, with alt text, placed on a new draft page.

Difficulty Beginner
Time ~10 min

Prerequisites

A site connected to WPVibe running Envira Gallery 1.17.0 or newer (free) on WordPress 6.9 or newer, with an administrator account. Allow AI to edit galleries is turned on under Envira Gallery, Settings, AI & MCP. The photos are already in your media library.

The prompt
My WordPress site uses Envira Gallery. Make a gallery from my photos of [what the photos show, or words from their titles] and put it on a new draft page called [page title].

1. Run discover_abilities with category envira-gallery. If the Envira Gallery abilities are not there, stop and tell me to install the free Envira Gallery plugin or update it to 1.17.0 or newer (it needs WordPress 6.9 or newer). Then run envira-gallery/describe-gallery-schema. If writes_enabled is false, stop and tell me to turn on Allow AI to edit galleries under Envira Gallery, Settings, AI & MCP in my WordPress admin, then ask again.
2. Search my media library with rest_api GET /wp/v2/media with search set to my words, media_type image, per_page 50, context edit and _fields id,title,alt_text,caption,source_url. It matches every word in titles, captions and descriptions, so if nothing fits, try each word on its own. Show me the matches as a numbered list with title, alt text (or: no alt text) and link; if 50 come back, tell me there may be more and offer to narrow the words. Wait for me to pick the photos and their order.
3. Envira copies each photo's title, alt text and caption from the media library at the moment the photo is added, and the gallery keeps that copy: fixing alt text in the media library later does not change the gallery. So before adding, list the picked photos with no alt text and write alt text of about 125 characters or fewer for each, from the photo itself if you can see it at its link, otherwise from its title, caption and file name, marked as a guess. Show me the list and wait for my yes or edits. For each approved photo, run rest_api GET /wp/v2/media/ID with context edit and skip it if alt_text is no longer empty; otherwise save it with rest_api_write POST /wp/v2/media/ID with alt_text only. Never change alt text that is already there.
4. Run envira-gallery/list-galleries with search set to the page title and status any. If a gallery with that title exists, show it with its photo count and ask whether to make a new one anyway. Then run envira-gallery/create-gallery with title set to the page title and status publish. Tell me why it is published: an Envira gallery has no page of its own (the url the ability returns does not open for visitors) and shows only where a page places it, and a draft gallery shows nothing even on a published page. Tell me its gallery ID.
5. Run envira-gallery/add-images once with the gallery_id and attachment_ids in my order. If any come back in skipped, tell me which: they are not in the media library, or were uploaded by someone whose uploads this account can't edit.
6. Check for a page with that title first: rest_api GET /wp/v2/pages with search set to it, status any and _fields id,title,status,link; if one exists, show it and ask whether to make a new one anyway. Create the page with rest_api_write POST /wp/v2/pages with the title, status draft, and content: a paragraph block with one short line about the photos if I gave you one, then a Shortcode block (the block comment wp:shortcode) holding the envira-gallery shortcode with id="GALLERY_ID" inside square brackets. Do not publish the page.
7. Check: run envira-gallery/get-gallery and confirm its status is publish and image_count matches. Read the gallery's photos with rest_api GET /wp/v2/envira-gallery/GALLERY_ID with context edit, _fields id,status,gallery_data.gallery,gallery_data.config.random and max_length 4000000 (a read of one gallery takes any max_length; without it a long answer is cut). gallery_data.gallery lists its photos in order, each with id, title, alt and caption. If the answer still says it was cut (TRUNCATED), tell me the photo list is incomplete. Confirm the photo IDs are in my order and each has the alt text from step 3. Run rest_api GET /wp/v2/pages/PAGE_ID with context edit and confirm the content holds the shortcode with the right id. Give me the link to edit the page and tell me the gallery appears when I publish the page.
Already connected?

Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:

Run the “Make a Photo Gallery Page from Your Media Library with Envira Gallery and AI” recipe from the WPVibe cookbook on my connected site.

The photos from the event, the finished project or the new menu are already in your media library. Turning them into a gallery page still means building the gallery, picking each photo, copying its shortcode and making a page for it, so the photos sit unused.

Tell the AI what the photos show. It searches your media library, shows you the matches, and writes alt text for the ones you pick that have none, saved only after your yes. Then it builds an Envira gallery from them in your order and puts it on a new draft page, which stays a draft until you publish it.

Alt text comes first because Envira copies it into the gallery when a photo is added and keeps that copy. The AI publishes the gallery itself, because an Envira gallery has no page of its own and a draft gallery shows nothing even on a published page. The recipe makes a block editor page; on a page builder, place the gallery with the builder’s own element. To add photos to a gallery you already have, use this recipe.

Outcome

A published Envira gallery of the photos you picked, in your order and with alt text, on a new draft page that shows it once you publish the page.