Support

Account

Home Forums Add-ons Repeater Field if (checkbox) = "Text" than html-Code Reply To: if (checkbox) = "Text" than html-Code

  • Since I’ve now spent too much time trying to do the same thing, and finding this post with no update, I wanted to post a solution for others (or myself when I search again)

    Even though “value” is selected on the checkbox, the item is still stored as an array. As such, you do just a normal “get_field” as you’d be getting an array that returns “1”.

    We need the info contained in the array.

    $variable = get_field(‘acffield’);
    $var_value = $variable[‘value’];

    Now we can see the values;

    if ($var_value == “first”) {
    echo “do this”;
    }
    elseif ($var_value ==”second”) {
    echo “do that”;
    }

    Hopefully that gets someone else on the right track.