The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Conditional Range Shortcode
Inspired by the compare shortcode detailed at https://formidableforms.com/knowledgebase/php-examples/, I created a simple shortcode which will check if a given value/field is in range of two other values/fields.
//* Usage: [range low="[X]" high="[Z]" value="[Y]"]
add_shortcode('range', 'between_func');
function between_func ($atts, $content="") {
extract(shortcode_atts(array('low' => '', 'high' => '', 'value' => ''), $atts));
if (($value >= $low) && ($value <= $high)) {
$content = $value;
}
else {
$content = '';
}
return $content;
}
Hope this helps others!
Discussion closed.