• Resolved ttmt

    (@ttmt)


    Hi all

    Great plugin, I hope it can do what I want.

    I have a loop field that adds products to a display.

    Each product has an image some text and a true/false box called live

    Is it possible to use a condition statement when adding the fields to the page.

    Something like ” if live == true add fields”

    https://wordpress.org/plugins/custom-field-suite/

Viewing 1 replies (of 1 total)
  • Plugin Author Matt Gibbs

    (@mgibbs189)

    A loop field is just an array of arrays. Just iterate through it like any other array.

    $loop = CFS()->get( 'my_loop_field' );
    foreach ( $loop as $row ) {
        if ( ! empty ( $row['live'] ) ) {
            echo $row['my_other_field'];
        }
    }
    
Viewing 1 replies (of 1 total)

The topic ‘Conditional statement in loop’ is closed to new replies.