Home › Forums › Front-end Issues › Display the sum of specific field at front-end › Reply To: Display the sum of specific field at front-end
I was wondering if you could help me out as well with a similar issue. I need to calculate the sum of an ACF number field in a CPT and show it in the front end with a shortcode… but I am not a programmer and don’t know how to write the code for it. I tried rewriting the code shown here – https://support.advancedcustomfields.com/forums/topic/calculating-a-sum-of-a-number-field-for-all-posts/ – with my own CPT and field slugs, etc, but it’s not working.
The custom post type is ‘investment_project’ and the field is ‘dashboard_value’. How do I create a function that will add all the number values in the Dashboard value field and show it through a shortcode?
All your help will be greatly appreciated!!!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
❓Ever wondered when and why ACF uses JSON instead of the database? Check out our summary of the most recent session of ACF Chat Friday for the answer, and make sure to register for the next session.— Advanced Custom Fields (@wp_acf) February 23, 2023
© 2023 Advanced Custom Fields.