I have a page that uses an ACF gallery.
I’ve also added a field to all image attachments called “gallery_size”.
This offers the options of Small, Medium or Large via a radio button.
My end goal is to use the size value to vary the width of the image in the gallery.
I have the gallery working, I can loop through the images and grab their descriptions and the size value. That’s all good.
The problem I have is that there are 300 images on the site and the “gallery_size” value is only becomes available if I open the image in the media gallery and update it.
Is there any way to auto update all the images rather than me having to do this manually?
You can workaround this issue by creating a custom foreach loop to step through all the gallery images and pass the field value to the update_field() function. The first parameter should be the field key as described on the following page: https://www.advancedcustomfields.com/resources/update_field/
I hope this info helps. Thank you.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users