Support » Plugin: Pods - Custom Content Types and Fields » Display based on custom field value

  • Resolved Jay Collier

    (@jcollier)


    In a Pods template, I would like to display specific text if a Yes/No custom field value is “Yes.”

    I tried this without success:

    [if event_registration_required.meta_value="Yes"] Registration is required [/if]

    I did confirm that the value of that field is “Yes”

    {@event_registration_required}

    Is this possible? If so, what is the correct syntax?

    • This topic was modified 2 months, 1 week ago by  Jay Collier.
    • This topic was modified 2 months, 1 week ago by  Jay Collier.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jim True

    (@jimtrue)

    That’s the incorrect syntax. you don’t have to add .meta_value when you’re inside a Pods Template or Template Tags (because they aren’t shortcodes). You only need to use .meta_value when you’re in a WHERE Clause in the Pods Shortcode.

    Correct Syntax would be:

    
    [if event_registration_required]Registration is required[/if]
    

    Yes/No Fields have a value if yes (1) and no value if no, so the if will work against them. You can’t do conditional clauses inside the if Template Tags, so if you’re trying to match a specific value, that will not work. You would need to use PHP if that’s what you need.

    Thank you! The simple solution is the best one.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.