• Resolved s1s2

    (@s1s2)


    [if field=test value='a'][/if] works.
    [if field=test value='b'][/if] works, too.

    I want to trigger the condition if a or b, but:

    [if field=test value='a','b'][/if] doesn’t work (I thought this was the right syntax from the documentation).

    [if field=test value='a' or value='b'][/if] doesn’t work.

    [if field=test value='a' or field_1=test value='b'][/if] doesn’t work.

    [if field=test value='a' or field_1=test value_1='b'][/if] doesn’t work.

    Thanks for any help.

    • This topic was modified 3 years, 9 months ago by s1s2.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Try this:

    [if field=test value=a,b compare=or][/if]

    • This reply was modified 3 years, 9 months ago by polarracing.
    Thread Starter s1s2

    (@s1s2)

    Thanks. I tried that, too, but I forgot to mention it. It doesn’t work, either.

    When I do that, the output I get is a list of all test values, not just a or b.

    The field “test” accepts a, b, c, d, e, and null. When I try what you suggest, I get output for a, b, c, d, e values. Only the test field with value null is not listed.

    I should also mention that values a, b, etc. must be within ‘ ‘ because they contain spaces.

    I don’t expect any of these things to make any difference, so this is just in case.

    I should also mention that values a, b, etc. must be within ‘ ‘ because they contain spaces.

    So the values you are checking are ‘ a’ and ‘ b’ instead of ‘a’ and ‘b’?

    The code you posted here does not reflect that – does your live code?

    BTW:
    Why you are saving spaces in the db?

    • This reply was modified 3 years, 9 months ago by polarracing.
    Thread Starter s1s2

    (@s1s2)

    What I called “a” and “b” in my example are strings of various length out of an ACF Select field.

    One of those values can be “Chair” (so no spaces) while another can be “Chaise Lounge” (so with a space in it).

    My original a and be example (with your recommended syntax) actually is:

    [if field=test value=“Chair”,”Chaise Lounge” compare=or][/if]

    And this doesn’t works.

    Ok, got the usecase.

    Try:

    [if field=test value='a,b' compare=or][/if]

    Thread Starter s1s2

    (@s1s2)

    It works. Great, thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘IF one value OR the other’ is closed to new replies.