Entries loop that doesn’t take the status into account? 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 %}
    &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 %}


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.
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.