Home › Forums › Add-ons › Gallery Field › Accessing Gallery Images by Index number › Reply To: Accessing Gallery Images by Index number
If you are trying to do something different with each image based on the number then the best way to do this is to do that inside of the loop.
$count = 0; // keep track of what image is being used
foreach ($cabin_photo_gallery as $image) {
if ($count < 5) {
// one of first 5
} else {
// the rest
}
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.