Answers.Body: <p>Your <code>if</code> statements looks correct. You might check that you are testing the value vs. the name (i.e. 'Portrait' vs 'portrait') or printing out the value (using <code>{{ entry.postAspectRatio }}</code>) so you can see the output. Also, a 'dryer' way to write this might be:</p>
  
  <pre><code>{% block content %}
  
      {% for entry in craft.entries.section('projects').order('postDate asc').limit(500).find() %}
  
          &lt;div class="title {{ entry.postAspectRatio|lower }}"&gt;
              &lt;a href="{{ entry.url }}"&gt;
                  &lt;p&gt;&lt;span&gt;{{ entry.studio }}&lt;/span&gt;{{ entry.title }}&lt;/p&gt;
              &lt;/a&gt;
          &lt;/div&gt;
  
      {% endfor %}
  
  {% endblock %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-15T00:19:52.973Z
Answers.LastActivityDate: 2014-12-15T00:19:52.973Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>I'm showing entries on a page. Depending on the value of the field <code>postAspectRatio</code>, I would like the layout of this shown entry to change just slightly and thus requiring it's own unique markup. </p>
  
  <p>I've tried to do this using what I know about twig IF syntax but it's not working. </p>
  
  <p>Any help?</p>
  
  <pre><code>{% block content %}
  
  {% for entry in craft.entries.section('projects').order('postDate asc').limit(500).find() %}
  
          {% if entry.postAspectRatio == 'Portrait' %}
  
          &lt;div class="title portrait"&gt;
              &lt;a href="{{ entry.url }}"&gt;
                  &lt;p&gt;&lt;span&gt;{{ entry.studio }}&lt;/span&gt;{{ entry.title }}&lt;/p&gt;
              &lt;/a&gt;
          &lt;/div&gt;
  
          {% endif %}
  
          {% if entry.postAspectRatio == 'Landscape' %}
  
          &lt;div class="title landscape"&gt;
              &lt;a href="{{ entry.url }}"&gt;
                  &lt;p&gt;&lt;span&gt;{{ entry.studio }}&lt;/span&gt;{{ entry.title }}&lt;/p&gt;
              &lt;/a&gt;
          &lt;/div&gt;
  
          {% endif %}
  
  {% endfor %}
  
  {% endblock %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-13T07:59:10.147Z
Comments.Text: Your syntax is right. What type of field is `postAspectRatio`?
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-13T08:04:12.557Z
Comments.Text: Test the output with `{{ entry.postAspectRatio }}`.
Comments.UserDisplayName: carlcs
Tags: <templating><entries>
Title: How to show entries with IF statement based on field
ThreadText: # How to show entries with IF statement based on field
  
  (Asked by: username_0 on 2014-12-13)
  
  I'm showing entries on a page. Depending on the value of the field `postAspectRatio`, I would like the layout of this shown entry to change just slightly and thus requiring it's own unique markup.
  
  I've tried to do this using what I know about twig IF syntax but it's not working.
  
  Any help?
  
  ```
  {% block content %}
  
  {% for entry in craft.entries.section('projects').order('postDate asc').limit(500).find() %}
  
          {% if entry.postAspectRatio == 'Portrait' %}
  
          <div class="title portrait">
              <a href="{{ entry.url }}">
                  <p><span>{{ entry.studio }}</span>{{ entry.title }}</p>
              </a>
          </div>
  
          {% endif %}
  
          {% if entry.postAspectRatio == 'Landscape' %}
  
          <div class="title landscape">
              <a href="{{ entry.url }}">
                  <p><span>{{ entry.studio }}</span>{{ entry.title }}</p>
              </a>
          </div>
  
          {% endif %}
  
  {% endfor %}
  
  {% endblock %}
  
  ```
  
  **Tags:** templating, entries
  
  > **Comments:**
  > **username_1**: Your syntax is right. What type of field is `postAspectRatio`?  
  > **username_1**: Test the output with `{{ entry.postAspectRatio }}`.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2014-12-15. Score: 1
  
  Your `if` statements looks correct. You might check that you are testing the value vs. the name (i.e. 'Portrait' vs 'portrait') or printing out the value (using `{{ entry.postAspectRatio }}`) so you can see the output. Also, a 'dryer' way to write this might be:
  
  ```
  {% block content %}
  
      {% for entry in craft.entries.section('projects').order('postDate asc').limit(500).find() %}
  
          <div class="title {{ entry.postAspectRatio|lower }}">
              <a href="{{ entry.url }}">
                  <p><span>{{ entry.studio }}</span>{{ entry.title }}</p>
              </a>
          </div>
  
      {% endfor %}
  
  {% endblock %}
  
  ```
  
  
  ---
  
  