I am using Advanced custom fields plugin with my wordpress. The page is based on realia so I need to show for example: garage yes/no. Balcony Y/N etc.
I have used true/false field type but it always returns 1/0. I would like to receive yes/no instead (or my own defined string). I thought use true/false. I can't find any setting in ACF to set the return value. Thanks
P粉5305192342023-09-11 00:23:32
Have you tried using the styled UI of fields? You can set text on it.
However, if you want to get the value programmatically, you can do it like this:
$text = get_field(name) ? '是' : '否'
This will create a variable with an if else statement. Returns 'Yes' if the condition is true, otherwise returns 'No'.