Home › Forums › ACF PRO › Conditional if more than 1 image added to gallery? › Reply To: Conditional if more than 1 image added to gallery?
You really should check for 3 conditions, no images, 1 image, more than 1 image
$images = get_field(gallery_field);
// the above will return something
// other than an array
// if there are no images
if (is_array($images)) {
// at lease 1 image
if (count($images) == 1) {
// only 1 image
} else {
// more than 1 image
}
}
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.