• Hi,

    I can’t get the conditional [if] shortcode to work with an ACF True/False field inside a [related] shortcode, although the ACF True/False field is correctly returned for each related post.
    Here’s the code:

    [related my_acf_relationship_field]
    
        [if field=my_acf_truefalse_field value=1]
            TRUE / [field my_acf_truefalse_field]
        [else]
            FALSE / [field my_acf_truefalse_field]
        [/if]
    
    [/related]

    Let’s say i have 3 related posts and the first one has the ACF True/False ticked, the output is:

    FALSE / 1
    FALSE /
    FALSE /

    The first one should be TRUE / 1

    Any hint please?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter studioavanti

    (@studioavanti)

    I should also mention that the conditional works fine outside of a [related] shortcode, on the related posts single page for instance.

    Thread Starter studioavanti

    (@studioavanti)

    I got something’s working, using the CCS [pass] shortcode:

    [related my_acf_relationship_field]
    
        [pass field= my_acf_truefalse_field]
            [if pass='{FIELD}' value=1]
                TRUE / [field my_acf_truefalse_field]
            [else]
                FALSE / [field my_acf_truefalse_field]
            [/if]
        [/pass]
    
    [/related]

    Curious, [pass] gets the ACF True/False field value and is able to check it when [if] alone didn’t.

    Had the same question, thanks for the idea. And following if there is an official statement on what is supported with ACF related.

    I have still an issue to implement a query / filter within a related field…

    • This reply was modified 5 years, 7 months ago by Nebaon.

    Thank you for posting this! I was having the same exact issue, and using pass worked!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Check ACF True/False in related posts’ is closed to new replies.