Title: IF statement inside nested repeaters
Last modified: August 22, 2016

---

# IF statement inside nested repeaters

 *  Resolved [jgateman](https://wordpress.org/support/users/jgateman/)
 * (@jgateman)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/if-statement-inside-nested-repeaters/)
 * One other quick question.
 * Inside of my nested repeaters, if the “exercise_name” field has “Off” as a value,
   I would like the url link to be inactive as the “exercise_post_id” will be 0.
   Otherwise if there is any other value than “off” in the “exercise_name” then 
   the link should embed the “exercise_post_id”. Conversely it could also work to
   see if the “exercise_post_id” has a value of “0” and eliminate the link and just
   show the “exercise_name”.
 * I have tried the scenario below but cannot get it to work. I have removed the
   outer tags on the link to post in here:
 * [raw]
    [repeater field=”program_day” num=”2″] [-repeater field=”exercise”] [if
   field exercise_name value=”off”] [field exercise_name] [else] a href=”index.php?
   p=[field exercise_post_id]”>[field exercise_name] [/if] [/-repeater] [/repeater][/
   raw]
 * [https://wordpress.org/plugins/custom-content-shortcode/](https://wordpress.org/plugins/custom-content-shortcode/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/if-statement-inside-nested-repeaters/#post-5792273)
 * I’ll have to check if the [if] statement works correctly inside nested repeaters,
   but meanwhile, could you try with the parameters like this?
 *     ```
       [if field="exercise_name" value="off"]
       ```
   
 *  Thread Starter [jgateman](https://wordpress.org/support/users/jgateman/)
 * (@jgateman)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/if-statement-inside-nested-repeaters/#post-5792285)
 * Perfect! That worked. I noticed some of the entries in the site are “off” with
   no capital or “Off” with a capital and the value has to match exactly. Is there
   a way to write it to look for both values “off” and “Off”? Do I just put an additional
   if statement in for the other “off”? Thanks!
 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/if-statement-inside-nested-repeaters/#post-5792287)
 * That sounds like a common use case, so I added an additional parameter in the
   latest update. To compare a lowercased version of field value:
 *     ```
       [if field="exercise_name" value="off" lowercase="true"]
       ```
   
 *  Thread Starter [jgateman](https://wordpress.org/support/users/jgateman/)
 * (@jgateman)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/if-statement-inside-nested-repeaters/#post-5792288)
 * Awesome! Thank you very much! You are the best!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘IF statement inside nested repeaters’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [jgateman](https://wordpress.org/support/users/jgateman/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/if-statement-inside-nested-repeaters/#post-5792288)
 * Status: resolved