Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calliaweb/516a5372e958f160d17e to your computer and use it in GitHub Desktop.
Save calliaweb/516a5372e958f160d17e to your computer and use it in GitHub Desktop.
Display Advanced Custom Fields Gallery as an Envira Gallery
@stygmate
Copy link

Hi, I'm using a very similar code but i found that the lightbox always opens on first image of galleries generated this way. any idea ?

@calliaweb
Copy link
Author

I would check that the link line is correct. Is it setting the same image url for all the thumbnails?

@stygmate
Copy link

I would check that the link line is correct. Is it setting the same image url for all the thumbnails?
I use a acf image gallery and enumerate image this way.

			foreach ( $image_ids as $image_id ) {
				$newdata["gallery"][ ( $image_id["id"] ) ]["status"] = 'active';
				$newdata["gallery"][ ( $image_id["id"] ) ]["src"]    = $image_id["url"];
				$newdata["gallery"][ ( $image_id["id"] ) ]["title"]  = $image_id["title"];
				$newdata["gallery"][ ( $image_id["id"] ) ]["link"]   = $image_id["url"];
				$newdata["gallery"][ ( $image_id["id"] ) ]["alt"]    = $image_id["alt"];
				$newdata["gallery"][ ( $image_id["id"] ) ]["thumb"]  = $image_id["sizes"]["thumbnail"];
			}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment