Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: [Waiting for user confirmation] Need to perform 4 different calculations on the same website

$
0
0

I tried it but it still wasn't working properly, so I took a look a the code in the functions.php and it occurred to me that maybe I was asking the impossible:

If under 18 then X
If between 18 and 22 then Y
If over 22 then Z

So I modified the code in the functions.php thusly:

add_filter('compare_format_filter', 'compare_format_filter_func');
function compare_format_filter_func($v)
{
    $res = '';
    if($v<18)$res= 'FVREB Buyer\'s Market';
    if($v>17.99 && $v<22)$res= 'FVREB Balanced Market';
    if($v>21.99)$res= 'FVREB Seller\'s Market';
    //here you can add more conditions
    return $res;
}

I've tested with 17.99, 18, 21.99, 22 – and number in between – and it's all working.

Do you foresee the possibility of any issues with the above?

And thank you very much for your help and your patience!


Viewing all articles
Browse latest Browse all 20145

Trending Articles