Skip Navigation

[Closed] Get sum of custom fields

This support ticket is created 2 years, 8 months 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 1 reply, has 2 voices.

Last updated by Luo Yang 2 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#2324189
ceu-summary.png
ceu-sum-hours.png
ceu-hours.png

Tell us what you are trying to do?
We have a custom post type called "CEU Hours" (see ceu-hours.png). This cpt has two custom fields, "Course Title" (post reference) and "Hours" (number). We have a view where we show all CEU Hours by year (see ceu-sum-hours.png) for the currently logged in user, and would like to:

a) Show a sum of all the CEU Hours at the end of the table (see ceu-sum-hours.png).
b) Show that same sum only for the current year (years are assigned as taxonomies), and how many hours are remaining, in this case remaining hours would be 12 minus the sum of all CEU Hours for the current year (see ceu-summary.png), if 12 or more are completed, it would just show 0.

Is there any documentation that you are following?
Found some related support tickets but they have all been archived.
We're using the instructions on this post to create the taxonomy-cpt relationship https://toolset.com/2015/07/how-to-group-posts-by-category/

I have provided admin access to this site in a previous ticket but can send again if needed.

Thank you.

#2324677

Hello,

Toolset Views can only display data of custom fields, can not do the calculation, so there isn't such kind of built-in feature, it needs custom codes, if you need more assistance for it, please provide a test site with the same problem, also point out:
- The problem page URLs
- The post view URL

I need to test and debug it in a live website, thanks

The topic ‘[Closed] Get sum of custom fields’ is closed to new replies.