Custom Fields
Re-Envisioned
Support MB Views If statement doesn't seem to work

  • Creator
    Topic
  • #27299
    Resolved Henri
    Participant

    Hi Metabox,

    I've added the following MB view as a shortcode block:

         {{ post.online_evenement }}
            {% if '{{ post.online_evenement }}' != 1 %}
                <h3>Locatie {{ post.online_evenement }}</h3>
                <div class="locatie_gegevens">
                    <div>
                        {{ post.naam_bedrijf }}
                    </div>
                    <div>
                        {{ post.straat }} {{ post.straat_nummer }}
                    </div>
                    <div>
                        {{ post.postcode }} {{ post.stad }}
                    </div>
                    <div>
                        {{ post.land }}
                    </div>
                </div>
            
            {% endif %}

    The field Post.online_evenement is a checkbox, so it has a value of 1 if checked and a value of zero if it is not checked. The MB view displays the value when rendered, but it also displays the content between the if statement, no matter if the field is checked or unchecked. See the following screen recording: https://share.getcloudapp.com/4gu22RmY

    What am I doing wrong in the if-statement? Can you help me?

    Kind regards, Henri

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