Count of Images in Meta Box Image Advanced Field

In the BricksLabs Facebook group a user asks:

Is there a way to count images inside a post that uses metabox image upload ?

This Pro tutorial provides the code for getting the count of the number of images in an Image Advanced type of custom field created using Meta Box.

We are going to define a custom function and can then use it with the Dynamic data tag in Bricks to, for example, conditionally render a Section only if there is at least one image uploaded/selected to/for the field.

with the Dynamic data being

{echo:bl_get_image_count_image_advanced(image_advanced_vsoh9ful7jb)}

where image_advanced_vsoh9ful7jb is the field ID.

Add the following in child theme's functions.php (w/o the opening PHP tag) or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Instant access to 390+ Bricks code tutorials with BricksLabs Pro