Answers.Body: <p>You will want to first create an 'elementCriteriaModel' to retrieve only the 'featured' images from the 'thumbnails' asset group, which will return an array like object (not technically an array) which you can loop through to display.</p>
  
  <pre><code>{% set images = craft.assets.group('thumbnails').featured(1) %}
  {% for image in images %}
      &lt;div class="rollover-item wd ux dv print"&gt;              
          &lt;img src="assets/img/{{ image.filename }}" alt="{{ image.filename }}"&gt;
          &lt;a class="preview" href="work/{{ image.clientname }}"&gt;{{ image.caption }}&lt;/a&gt;
      &lt;/div&gt;
  {% endfor %}
  </code></pre>
  
  <p>Another method that might be easier to manage from a client perspective is to add an <code>assets</code> fieldType to your homepage section (called 'featuredImages' or whatever; limited of course to the 'thumbnails' asset group) which the client can use to add and/or reorder the featured thumbnails to be displayed. In which case the code would look something more like this.</p>
  
  <pre><code>{% if entry.featuredImages|length %}
      {% for image in entry.featuredImages %}
          &lt;div class="rollover-item wd ux dv print"&gt;              
              &lt;img src="assets/img/{{ image.filename }}" alt="{{ image.filename }}"&gt;
              &lt;a class="preview" href="work/{{ image.clientname }}"&gt;{{ image.caption }}&lt;/a&gt;
          &lt;/div&gt;
      {% endfor %}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-25T17:28:57.993Z
Answers.Text: I tried the first option but it still would not show any of the thumbnails.  I do not want to do the second because this grid that is used to display the thumbnails will be on one other page but not all the pages and not just that one, and while I do not understand craft all that well yet I do not want that as part of the template for the single pages.  Perhaps there is an error on how I am saving the images or something, I will just have to keep at it.  Thanks you.
Answers.UserDisplayName: Rockwell Rice
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-25T17:41:17.373Z
Answers.Text: There may be an issue with the naming. Check that the asset group handle is called "thumbanils", that the radio button field handle is called "featured" and that the yes/featured value is "1" (or modify the code accordingly). If the value of the "featured" option is something else (like "featured") then use that value instead (i.e. `craft.assets.group('thumbnails').featured('featured')`.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-25T17:49:30.850Z
Answers.Text: The advantage of using an assets field is that you can reorder the images, something that you won't be able to do by retrieving the assets directly. The other advantage is that you can later selectively feature the same image on more than one page if needed. Keep in mind that you can always retrieve the data from whatever entry it is stored on and use that data on other pages (just retrieve the entry and loop through the information as normal). You could even save this as a separate macro file or template include file to be used anywhere as needed.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-25T18:10:16.310Z
Answers.Text: yes that was it, the value was set to "featured" instead of "1." I will check this off as answered, thanks much for your help.
Answers.UserDisplayName: Rockwell Rice
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-25T18:26:42.180Z
Answers.Text: You might want to use a global assets field - then it wouldn't be tied to a specific page.
Answers.UserDisplayName: Marion Newlevant
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-25T18:45:55.610Z
Answers.Text: @MarionNewlevant good idea!
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-26T12:02:07.973Z
Answers.Text: Thanks for the suggestions, as I said I am totally new to this so while some of it is pretty standard some of the rendering things have stumped me.  I will try these out once I have some time.  Thanks again.
Answers.UserDisplayName: Rockwell Rice
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-25T16:46:24.603Z
Answers.LastActivityDate: 2015-06-25T16:54:05.453Z
Answers.LastEditDate: 2015-06-25T16:54:05.453Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>I am fairly new to Craft CMS coming from ruby on rails and angularjs.  I am running into an issue with attempting to display images on a home page based on whether or not the radio button titled "featured" ( a field) is selected.</p>
  
  <p>I have searched around but was unable to find something addressing this, or at least in a way I understood to solve the problem.</p>
  
  <p>I have been trying variations of... </p>
  
  <pre><code>{% if thumbnails.featured %}
  </code></pre>
  
  <p>...hoping it would only display what has "featured" selected but it either breaks and shows nothing or shows all the images.  Based on what I have found I think I have to "set" something but am unable to figure out exactly how that is set up.  This is exactly what I have right now and it is showing all images.</p>
  
  <pre><code>{% for thumbnails in craft.assets.thumbnails %}
      {% if thumbnails.featured %}
          &lt;div class="rollover-item wd ux dv print"&gt;              
              &lt;img src="assets/img/{{ thumbnails.filename }}" alt="{{ thumbnails.filename }}"&gt;
                      &lt;a class="preview" href="work/{{ thumbnails.clientname }}"&gt;{{ thumbnails.caption }}&lt;/a&gt;                     
          &lt;/div&gt;
      {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>If anyone could suggest a solution or even point me in the right direction it would be greatly appreciated.</p>
  
Tags: <templating><filter><entries-field>
Title: How to filter what is showed based on radio button checked
ThreadText: # How to filter what is showed based on radio button checked
  
  (Asked by: username_0 on 2015-06-25)
  
  I am fairly new to Craft CMS coming from ruby on rails and angularjs. I am running into an issue with attempting to display images on a home page based on whether or not the radio button titled "featured" ( a field) is selected.
  
  I have searched around but was unable to find something addressing this, or at least in a way I understood to solve the problem.
  
  I have been trying variations of...
  
  ```
  {% if thumbnails.featured %}
  
  ```
  
  ...hoping it would only display what has "featured" selected but it either breaks and shows nothing or shows all the images. Based on what I have found I think I have to "set" something but am unable to figure out exactly how that is set up. This is exactly what I have right now and it is showing all images.
  
  ```
  {% for thumbnails in craft.assets.thumbnails %}
      {% if thumbnails.featured %}
          <div class="rollover-item wd ux dv print">              
              <img src="assets/img/{{ thumbnails.filename }}" alt="{{ thumbnails.filename }}">
                      <a class="preview" href="work/{{ thumbnails.clientname }}">{{ thumbnails.caption }}</a>                     
          </div>
      {% endif %}
  {% endfor %}
  
  ```
  
  If anyone could suggest a solution or even point me in the right direction it would be greatly appreciated.
  
  **Tags:** templating, filter, entries-field
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-06-25. Score: 1 | Accepted answer
  
  You will want to first create an 'elementCriteriaModel' to retrieve only the 'featured' images from the 'thumbnails' asset group, which will return an array like object (not technically an array) which you can loop through to display.
  
  ```
  {% set images = craft.assets.group('thumbnails').featured(1) %}
  {% for image in images %}
      <div class="rollover-item wd ux dv print">              
          <img src="assets/img/{{ image.filename }}" alt="{{ image.filename }}">
          <a class="preview" href="work/{{ image.clientname }}">{{ image.caption }}</a>
      </div>
  {% endfor %}
  
  ```
  
  Another method that might be easier to manage from a client perspective is to add an `assets` fieldType to your homepage section (called 'featuredImages' or whatever; limited of course to the 'thumbnails' asset group) which the client can use to add and/or reorder the featured thumbnails to be displayed. In which case the code would look something more like this.
  
  ```
  {% if entry.featuredImages|length %}
      {% for image in entry.featuredImages %}
          <div class="rollover-item wd ux dv print">              
              <img src="assets/img/{{ image.filename }}" alt="{{ image.filename }}">
              <a class="preview" href="work/{{ image.clientname }}">{{ image.caption }}</a>
          </div>
      {% endfor %}
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: I tried the first option but it still would not show any of the thumbnails.  I do not want to do the second because this grid that is used to display the thumbnails will be on one other page but not all the pages and not just that one, and while I do not understand craft all that well yet I do not want that as part of the template for the single pages.  Perhaps there is an error on how I am saving the images or something, I will just have to keep at it.  Thanks you.  
  > **username_1**: There may be an issue with the naming. Check that the asset group handle is called "thumbanils", that the radio button field handle is called "featured" and that the yes/featured value is "1" (or modify the code accordingly). If the value of the "featured" option is something else (like "featured") then use that value instead (i.e. `craft.assets.group('thumbnails').featured('featured')`.  
  > **username_1**: The advantage of using an assets field is that you can reorder the images, something that you won't be able to do by retrieving the assets directly. The other advantage is that you can later selectively feature the same image on more than one page if needed. Keep in mind that you can always retrieve the data from whatever entry it is stored on and use that data on other pages (just retrieve the entry and loop through the information as normal). You could even save this as a separate macro file or template include file to be used anywhere as needed.  
  > **username_0**: yes that was it, the value was set to "featured" instead of "1." I will check this off as answered, thanks much for your help.  
  > **username_2**: You might want to use a global assets field - then it wouldn't be tied to a specific page.  
  > **username_1**: @username_2 good idea!  
  > **username_0**: Thanks for the suggestions, as I said I am totally new to this so while some of it is pretty standard some of the rendering things have stumped me.  I will try these out once I have some time.  Thanks again.  
  
  ---
  
  