I’m in a circumstance where I need to both limit and randomize the images of a gallery field shown on a template. This area of the template is intended to be a preview of the gallery that links (through a “see the whole gallery” button) to a page where the full gallery is shown.
The gallery is not directly attached to the custom page fields, but through a relationship field called page_sidebar_gallery (so I can select the same gallery on multiple pages). My code looks like this:
However, I’m not sure where I can set output parameters in the foreach loop. While I can use wp_query for the outside loops, I don’t seem to have similar parameter options in the ‘foreach ( $gallery_images as $image )’.
Thanks for your help pointing me in the right direction!
Viewing 1 post (of 1 total)
The topic ‘Limit and randomize the display of images in a Gallery field on template’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users