Hi, i have two field
1. field-price
2. field-size
i need to calculate field price /(divide) field size and round up to integer .
How do we take 2 custom field and do math operations?
Hello,
Unfortunately we do not currently offer a way to perform mathematical operations on custom field values within Views. This must be accomplished with custom code, perhaps as a shortcode that can perform calculations on multiple values, or as JavaScript that performs calculations on the front-end of your site.
Here is a link to the WordPress documentation on shortcodes:
http://codex.wordpress.org/Function_Reference/add_shortcode
If you need professional help with this code, you can contact one of our certified partner contractors. Here is the list of our contractors:
https://toolset.com/consultant/
Hi Christian, thanks for the reply.
i know little bit of coding, when you say
" shortcode that can perform calculations on multiple values "
is exactly what im looking for. Could you provide a simple sample code how this can be calculated and i could study from there ?
how do i call the field value to template functions ? that's something new.
Hi, thanks for the sample links.
But i notice most of them contain wpv-loops .
Can the code be used at layout as well ?
Hi -
Yes, you can use a shortcode in a Layout. As long as you have access to the information you need (the values you want to use), and can pass that information into the shortcode (using a shortcode attribute), you can use that shortcode without a loop.