Answers.Body: <p>From your example, it is a bit hard to tell how your site is organized, but it sounds like you want to set up content specific to each ministry (which is stored in the top-level of your "site_content" structure?), which will be shared across all of that ministry's sub-pages. Regardless, you will essentially want to retrieve the entry where the slider data is stored, and loop through the matrix data from there.</p>
  
  <pre><code>{% if craft.request.segment(2) == "crosstrainers" %}
      {% set entry = craft.entries.section('site_content').slug('crosstrainers') %}
      {% for block in entry.slider %}
          {# prevent error if no slider image is defined #}
          {% if block.sliderImage|length %}
              {% set image = block.sliderImage.first() %}
              &lt;img class="slider-image" src="{{ image.getUrl }}" alt="{{ entry.title }}" /&gt;
              ...
          {% endif %}
      {% endfor %}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-25T19:38:34.683Z
Answers.Text: Douglas, thank you.  I didn't give you enough information, sorry about that, but you did help me see what I was doing wrong.  Working perfect.  Thank you again.
Answers.UserDisplayName: user1663102
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-25T17:36:02.770Z
Answers.LastActivityDate: 2015-06-25T17:36:02.770Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>I am new to Craft and have a decent handle on the basics, but I am struggling a little getting this to work.  Here is what I would like to do:</p>
  
  <p>I have a banner with bxslider which will be looping through images in a matrix field.  This is for a church site and this template will be used for all their ministries.  Each ministry will have it's own photos, but right now assets is returning images for all entries.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>{% elseif craft.request.segment(2) == "crosstrainers" %}
  
  &lt;div class="banner-slider-block"&gt;
  
      &lt;ul class="banner-slider-list"&gt;
  
          {% for entry in craft.entries
              .section('site_content')
              .find() 
          %}
  
          {% for block in entry.slider %}     
          &lt;li&gt;
  
              &lt;div class="banner-slide-block"&gt;
  
                      {% for image in block.sliderImage.limit(1) %}
                          &lt;img class="slider-image" src="{{ image.getUrl }}" alt="{{ entry.title }}" /&gt;
                      {% endfor %}
  
                      &lt;div class="page-wrapper"&gt;
  
                          &lt;div class="slider-text-box {{ block.sliderTextBoxLocation }}"&gt;
  
                              &lt;h3 class="slider-header"&gt;{{ block.sliderHeader}}&lt;/h3&gt;
  
                              &lt;p class="slider-text"&gt;{{ block.sliderText}}&lt;/p&gt;
  
                              &lt;a class="slider-button" href=""&gt;&lt;div class="linked-button"&gt;{{ block.sliderButtonText}}&lt;/div&gt;&lt;/a&gt;
  
                          &lt;/div&gt;
  
                      &lt;/div&gt;          
  
              &lt;/div&gt;
  
          &lt;/li&gt;
          {% endfor %}
  
          {% endfor %}
  
      &lt;/ul&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>Any suggestions on how to limit the asset results to each ministry.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-25T15:33:59.857Z
Comments.Text: are you trying to get the first image from an asset field? are you looking for this? `{% set image = block.sliderImage.first() %}{{image.url}}`
Comments.UserDisplayName: Luke Holder
Tags: <assets><categories>
Title: Using categories to filter assets
ThreadText: # Using categories to filter assets
  
  (Asked by: username_0 on 2015-06-25)
  
  I am new to Craft and have a decent handle on the basics, but I am struggling a little getting this to work. Here is what I would like to do:
  
  I have a banner with bxslider which will be looping through images in a matrix field. This is for a church site and this template will be used for all their ministries. Each ministry will have it's own photos, but right now assets is returning images for all entries.
  
  Here is my code:
  
  ```
  {% elseif craft.request.segment(2) == "crosstrainers" %}
  
  <div class="banner-slider-block">
  
      <ul class="banner-slider-list">
  
          {% for entry in craft.entries
              .section('site_content')
              .find() 
          %}
  
          {% for block in entry.slider %}     
          <li>
  
              <div class="banner-slide-block">
  
                      {% for image in block.sliderImage.limit(1) %}
                          <img class="slider-image" src="{{ image.getUrl }}" alt="{{ entry.title }}" />
                      {% endfor %}
  
                      <div class="page-wrapper">
  
                          <div class="slider-text-box {{ block.sliderTextBoxLocation }}">
  
                              <h3 class="slider-header">{{ block.sliderHeader}}</h3>
  
                              <p class="slider-text">{{ block.sliderText}}</p>
  
                              <a class="slider-button" href=""><div class="linked-button">{{ block.sliderButtonText}}</div></a>
  
                          </div>
  
                      </div>          
  
              </div>
  
          </li>
          {% endfor %}
  
          {% endfor %}
  
      </ul>
  
  </div>
  
  ```
  
  Any suggestions on how to limit the asset results to each ministry.
  
  **Tags:** assets, categories
  
  > **Comments:**
  > **username_1**: are you trying to get the first image from an asset field? are you looking for this? `{% set image = block.sliderImage.first() %}{{image.url}}`  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2015-06-25. Score: 1
  
  From your example, it is a bit hard to tell how your site is organized, but it sounds like you want to set up content specific to each ministry (which is stored in the top-level of your "site\_content" structure?), which will be shared across all of that ministry's sub-pages. Regardless, you will essentially want to retrieve the entry where the slider data is stored, and loop through the matrix data from there.
  
  ```
  {% if craft.request.segment(2) == "crosstrainers" %}
      {% set entry = craft.entries.section('site_content').slug('crosstrainers') %}
      {% for block in entry.slider %}
          {# prevent error if no slider image is defined #}
          {% if block.sliderImage|length %}
              {% set image = block.sliderImage.first() %}
              <img class="slider-image" src="{{ image.getUrl }}" alt="{{ entry.title }}" />
              ...
          {% endif %}
      {% endfor %}
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: username_2, thank you.  I didn't give you enough information, sorry about that, but you did help me see what I was doing wrong.  Working perfect.  Thank you again.  
  
  ---
  
  