Find minimum value in select field
-
I’m using this plugin to connect two custom post types, Songs and Charts. Each song has a position between 1 and 100 on a given chart.
Example song: https://kurttrowbridge.com/songs/jessie-ware-champagne-kisses/
Example chart: https://kurttrowbridge.com/charts/kurts-top-100-october-26-2014/One of the fields I’m using is for “position,” a drop-down with
'values' => range(1, 100)
. I’d like to get the minimum value of all values connected to a given song – so for the example song linked above, the minimum would be 43.I know I can use
<?php echo p2p_get_meta( get_post()->p2p_id, 'position', true ); ?>
to get all of the connected values, but how can I get only the minimum of those values?Hopefully someone here can help – thank you if so.
- The topic ‘Find minimum value in select field’ is closed to new replies.