Support

Account

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
      }
    }