I will try to explain my question as best for the community as I can.
I have a custom post type in WordPress named "people" (which is the slug).
Each post type belonging to "people" has an Advanced Custom Field associated with it, simply named "number". The field type is a number.
Here is what I want to achieve:
I want to get the values for number for all the posts, on a foreach for example, that carries on for as many posts there are.
I then want to add all of these values up to produce a total.
I know how to handle the calculations in PHP, that's not an issue.
Can you please advice on the best way to collect all the numbers in the custom fields for all posts, and how to store them in order to calculate the total.
Thank you.
$total += $value;(inside).