Is there an easy way to echo out the number of images in a gallery?
For example, I’m showing the first image of each gallery on a page, with a title and under the title I’d like it to say something like “(23 photos)” .
Thanks for your help in advance.
Sure. So, the get_field function will return an array containing all the images right? Therefor, you can target the first image like so:
$images = $image;
As for the count? There is a PHP function called
count which will do this for you:
echo count( $images );
Perfect, thank you Elliot. (been using ACF for a while now, also repeater and gallery addons…and ACF (along with gravity forms) is easily one of the best coded plugin out there.
how to check if one image or more? (echo “1 picture” / “2 pictures“)
This kind of PHP question is best solved on google, not ACF