Ah. So, take the following for example.
I borrowed the code over at https://github.com/CMB2/CMB2/wiki/Field-Types#file_list as is, no edits.
I attached some images to a sample post, and then ran this snippet in the single.php file just for ease of example.
var_dump( get_post_meta( get_the_ID(), 'wiki_test_file_list', true ) );
This made the following output:
/app/public/wp-content/themes/twentyseventeen/single.php:23:
array (size=3)
25 => string 'https://www.example.com/wp-content/uploads/2018/08/1303483397485060.png' (length=63)
26 => string 'https://www.example.com/wp-content/uploads/2018/08/1305369424349688.jpg' (length=63)
27 => string 'https://www.example.com/wp-content/uploads/2018/08/1311363149881839.jpg' (length=63)
Based on this, you can get a count of the images by simply assigning the get_post_meta()
call to a variable and using the following example code:
echo count( $images );
For the example post, this would echo out “3” for my 3 images above. Should get you going on your needs.