Title: Conditional logic within shortcode
Last modified: May 19, 2022

---

# Conditional logic within shortcode

 *  Resolved [Reed Sutton](https://wordpress.org/support/users/reedus33/)
 * (@reedus33)
 * [4 years ago](https://wordpress.org/support/topic/conditional-logic-within-shortcode/)
 * Hi,
 * Is it possible to use conditional logic with the [pods] shortcode?
 * I want a way to only display the field value if there is content in it. Ie. if
   the field is null/empty, don’t display anything.
 * Something like this was my attempt:
    [pods name=”bank_account” id=”{{ post.id}}”
   where=”standard_interest_rate!=null”]{@standard_interest_rate}%[/pods]

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

 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [4 years ago](https://wordpress.org/support/topic/conditional-logic-within-shortcode/#post-15669616)
 * Hi [@reedus33](https://wordpress.org/support/users/reedus33/)
 * You can use [if] tags within Pods templates.
    You can include this within a shortcode
   as well, for example:
 *     ```
       [pods][if standard_interest_rate]{@standard_interest_rate}%[/if][/pods]
       ```
   
 *  Thread Starter [Reed Sutton](https://wordpress.org/support/users/reedus33/)
 * (@reedus33)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/conditional-logic-within-shortcode/#post-15685923)
 * None of these are working:
 * ${{ post.metadata.annual_fee }} [pods name=”credit_card” id=”{{ post.id }}” where
   =”fyf.meta_value=’Yes'”](FYF)[/pods]
 * ${{ post.metadata.annual_fee }} [pods][if fyf.meta_value=’Yes’]{@fyf}[/if][/pods]
 * for this page: [https://frugalflyer.ca/compare-credit-cards/](https://frugalflyer.ca/compare-credit-cards/)
 * fyf is a free text field with either ‘Yes’ or ‘No’ responses. If FYF is ‘Yes’,
   I want to show (FYF) next to the annual fee.
 * Please help!
 *  Thread Starter [Reed Sutton](https://wordpress.org/support/users/reedus33/)
 * (@reedus33)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/conditional-logic-within-shortcode/#post-15685948)
 * Nevermind got it working with this:
 * ${{ post.metadata.annual_fee }} [pods name=”credit_card” id=”{{ post.id }}”][
   if field=”fyf” value=”Yes”](FYF)[/if][/pods]
 * Follow up question:
 * **Can you do nested [if] shortcodes?**
    -  This reply was modified 3 years, 12 months ago by [Reed Sutton](https://wordpress.org/support/users/reedus33/).
 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/conditional-logic-within-shortcode/#post-15691556)
 * Hi [@reedus33](https://wordpress.org/support/users/reedus33/)
 * > Can you do nested [if] shortcodes?
 * I’m honestly not sure, I don’t think so but you should test 🙂
 * Cheers, Jory

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

The topic ‘Conditional logic within shortcode’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

## Tags

 * [condition](https://wordpress.org/support/topic-tag/condition/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 4 replies
 * 2 participants
 * Last reply from: [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * Last activity: [3 years, 12 months ago](https://wordpress.org/support/topic/conditional-logic-within-shortcode/#post-15691556)
 * Status: resolved