Skip Navigation

[Resolved] Maximum custom field value in JS

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by fahimS-2 1 year, 8 months ago.

Assisted by: Minesh.

Author
Posts
#2608101

I have a JavaScript code which I am using in my Toolset Archive. Now I need the maximum value of a custom field from all the posts of a custom post type. After obtaining the maximum value, I will use it in my JS code. Is there any way I can get the maximum value?

#2608153

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

This is pure PHP/WordPress question.

I suggest you should search google about how you can return the max value from the custom field for post type.
- hidden link

One way to do this in Toolset is to create a View for your post type , ordered by your custom field descending, and limited to 1 result and return whatever value you want to show in loop editor.

#2610133

My issue is resolved now. Thank you!