Skip Navigation

[Resolved] Shortcode for calculated total of custom field

This thread is resolved. Here is a description of the problem and solution.

Problem:

I want to calculate the total steps across all users.

Solution:

It is a custom codes problem, need some custom PHP codes, for example this thread:

https://toolset.com/forums/topic/counting-values-in-custom-field/

Relevant Documentation:

This support ticket is created 5 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by AustinB6251 5 years ago.

Assisted by: Luo Yang.

Author
Posts
#1361717

Tell us what you are trying to do?

I'm trying to create a website that can keep track of steps (like a pedometer) for a large group of people. Each person an individual step count that they can update the total of at any time.

So far I've setup a custom post type for 'Steps' and added a custom field 'steps' to this post type.

I've setup a cred form for a user to update their step count. I've setup a view for the individual steps, and setup a view for the total steps.

I've got everything setup and working as expected, but now I want to calculate the total steps across all users.

Is there any documentation that you are following?

I found suggestion for a really similar topic here, but I'm stuck at how to implement. I've added the code to functions.php and tried to add the second block of code here into the Total Steps view but I don't think this is correct.

https://toolset.com/forums/topic/counting-values-in-custom-field/

Is there a similar example that we can see?

N/A

What is the link to your site?

N/A - local site.

#1361755

Hello,

Since it is a custom codes problem, please provide a live website with the same problem, fill below private message box with login details and ftp access, also point out the problem page URL and view URL, where I can edit your PHP codes, I need a live website to test and debug, thanks

#1363045

Thanks - after some further tweaking I was able to get that code working!