Title: Conditional statement in loop
Last modified: August 21, 2016

---

# Conditional statement in loop

 *  Resolved [ttmt](https://wordpress.org/support/users/ttmt/)
 * (@ttmt)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/conditional-statement-in-loop/)
 * 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/](https://wordpress.org/plugins/custom-field-suite/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Matt Gibbs](https://wordpress.org/support/users/mgibbs189/)
 * (@mgibbs189)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/conditional-statement-in-loop/#post-5165041)
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-field-suite.svg)
 * [Custom Field Suite](https://wordpress.org/plugins/custom-field-suite/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-field-suite/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-field-suite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-field-suite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-field-suite/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Matt Gibbs](https://wordpress.org/support/users/mgibbs189/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/conditional-statement-in-loop/#post-5165041)
 * Status: resolved