[wp-hackers] Conditional statement inside custom query

John Blackbourn johnbillion+wp at gmail.com
Tue Aug 3 13:29:53 UTC 2010


This isn't intrinsically a WordPress query but here's the answer
anyway. Just replace the value of $fruit with the corresponding fruit
name which will then be used in your resulting array.

if ($fruit=="1") {
       $fruit='Apples';
       } elseif($fruit=="2") {
       $fruit='Cherries';
       }


More information about the wp-hackers mailing list