<p><strong>Short answer</strong></p>

<p>Change this line:</p>

<pre><code>{% for caseStudy in entry.featuredCaseStudies %}
</code></pre>

<p>to:</p>

<pre><code>{% for caseStudy in entry.featuredCaseStudies.status(null) %}
</code></pre>

<p><strong>Long answer</strong></p>

<p>If “featuredCaseStudies” is an Entries field, then typing <code>entry.featuredCaseStudies</code> will give you an <a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel" rel="nofollow">ElementCriteriaModel</a> object, configured to return all of the entries related to <code>entry</code> via that “featuredCaseStudies” field (using the <a href="http://buildwithcraft.com/docs/templating/craft.entries#relatedTo" rel="nofollow">relatedTo</a> param). Just like the ElementCriteriaModel object you get when typing <code>craft.entries</code>, you’re free to chain in additional parameters after <code>entry.featuredCaseStudies</code>.</p>

<p>By default, entry-targetting ElementCriteriaModel objects will only return “live” entries – entries that are enabled, and whose Post Date is in the past, and whose Expiry Date is either not set or set in the future. You can alter that behavior using entries’ <a href="http://buildwithcraft.com/docs/templating/craft.entries#status" rel="nofollow">status</a> criteria param. Setting it to <code>null</code> tells Craft to not factor entries’ statuses into the query whatsoever, which is what you’re looking for here.</p>

CC BY-SA 3.0
2015-10-02T08:07:31.343Z
Ah, I see! My problem was I was trying to go through a Matrix to do this (featuredCaseStudies was a Matrix, which had a block type that was Entries). This didn't work for that arragement, but I realised I could switch it to a plain Entries field rather than having to have a Matrix in this case. Thanks!
Matt Wilcox
CC BY-SA 3.0
2015-10-02T15:00:09.357Z
Ah gotcha - and now `caseStudy.caseStudy.first()` makes more sense; `caseStudy.caseStudy` was the Entries field; not `entry.featuredCaseStudies`. Was there any reason you did this with a Matrix field and sub-Entries field, rather than just a simple Entries field? (It looks like you had `status` and `url` fields on your Matrix blocks as well? Were those actually necessary or would it have been better to grab the actual case study entries’ statuses and URLs rather than duplicating that data in your Matrix field?)
Brandon Kelly
CC BY-SA 3.0
2015-10-02T15:01:15.967Z
Reason I ask is because you can get it to work either way - you just would need to add that `.status(null)` param to the _actual_ Entries field reference (`caseStudy.caseStudy.status(null)` rather than to `entry.featuredCaseStudies`.
Brandon Kelly
CC BY-SA 3.0
2015-10-05T08:12:56.540Z
In this case no, I'd just got stuck in a Matrix mindset, but I can see it being useful in a Matrix in future projects. Thanks for the info :)
Matt Wilcox
CC BY-SA 3.0
2015-10-01T18:57:41.703Z
2015-10-01T18:57:41.703Z
Brandon Kelly
<p>How do I create an entries loop that will pull content even if the entry in the loop is not set to Live?</p>

<p>e.g., I have a Matrix so a user can select entries to feature in a slider. They want the slider to feature entries even if the entry itself is currently hidden/unpublished.</p>

<pre><code>{% for caseStudy in entry.featuredCaseStudies %}
    &lt;div class="slide"&gt;
        &lt;div class="text"&gt;
            {% if caseStudy.status == 'live' %}&lt;a href="{{ caseStudy.url }}"&gt;{% endif %}
                &lt;img src="{{ caseStudy.caseStudy.first().clientLogo.first().getUrl('caseStudyTumbnail') }}" alt="" /&gt;
            {% if caseStudy.status == 'live' %}&lt;/a&gt;{% endif %}
        &lt;/div&gt;&lt;!-- .text --&gt;
    &lt;/div&gt;&lt;!-- .slide --&gt;
{% endfor %}
</code></pre>

<p>This works only in as much as the anchor is only output if the linked entry is live. But I can't get it to spit out the image; presumably because the entry isn't live.</p>

<matrix><elementcriteriamodel>
Entries loop that doesn’t take the status into account?
# Entries loop that doesn’t take the status into account?

(Asked by: username_0 on 2015-10-01)

How do I create an entries loop that will pull content even if the entry in the loop is not set to Live?
e.g., I have a Matrix so a user can select entries to feature in a slider. They want the slider to feature entries even if the entry itself is currently hidden/unpublished.
{% for caseStudy in entry.featuredCaseStudies %}
    
        
            {% if caseStudy.status == 'live' %}{% endif %}
                
            {% if caseStudy.status == 'live' %}{% endif %}
        
    
{% endfor %}

This works only in as much as the anchor is only output if the linked entry is live. But I can't get it to spit out the image; presumably because the entry isn't live.

**Tags:** matrix, elementcriteriamodel

---

## 1 answers

### Answer by username_1 on 2015-10-01. Score: 2 | Accepted answer

Short answer
Change this line:
{% for caseStudy in entry.featuredCaseStudies %}

to:
{% for caseStudy in entry.featuredCaseStudies.status(null) %}

Long answer
If “featuredCaseStudies” is an Entries field, then typing entry.featuredCaseStudies will give you an ElementCriteriaModel object, configured to return all of the entries related to entry via that “featuredCaseStudies” field (using the relatedTo param). Just like the ElementCriteriaModel object you get when typing craft.entries, you’re free to chain in additional parameters after entry.featuredCaseStudies.
By default, entry-targetting ElementCriteriaModel objects will only return “live” entries – entries that are enabled, and whose Post Date is in the past, and whose Expiry Date is either not set or set in the future. You can alter that behavior using entries’ status criteria param. Setting it to null tells Craft to not factor entries’ statuses into the query whatsoever, which is what you’re looking for here.

> **Comments:**
> **username_0**: Ah, I see! My problem was I was trying to go through a Matrix to do this (featuredCaseStudies was a Matrix, which had a block type that was Entries). This didn't work for that arragement, but I realised I could switch it to a plain Entries field rather than having to have a Matrix in this case. Thanks!  
> **username_1**: Ah gotcha - and now `caseStudy.caseStudy.first()` makes more sense; `caseStudy.caseStudy` was the Entries field; not `entry.featuredCaseStudies`. Was there any reason you did this with a Matrix field and sub-Entries field, rather than just a simple Entries field? (It looks like you had `status` and `url` fields on your Matrix blocks as well? Were those actually necessary or would it have been better to grab the actual case study entries’ statuses and URLs rather than duplicating that data in your Matrix field?)  
> **username_1**: Reason I ask is because you can get it to work either way - you just would need to add that `.status(null)` param to the _actual_ Entries field reference (`caseStudy.caseStudy.status(null)` rather than to `entry.featuredCaseStudies`.  
> **username_0**: In this case no, I'd just got stuck in a Matrix mindset, but I can see it being useful in a Matrix in future projects. Thanks for the info :)  

---

