<p>This should do it:</p>

<pre><code>&lt;ul&gt;
    {% if craft.request.isLivePreview() %}

        {# if it's Live Preview, grab even the disabled entries #}
        {% set entries = craft.entries.section('mySection').status(null).find() %}

    {% else %}

        {# not Live Preview, so just grab enabled entries #}
        {% set entries = craft.entries.section('mySection').find() %}

    {% endif %}

    {% for entry in entries %}
        &lt;li&gt;{{ entry.title }}&lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;
</code></pre>

CC BY-SA 3.0
2016-07-02T10:12:24.557Z
Thanks for your answer!
Now I see everything in the Live Preview, but also the entries which are disabled.
So is it possible to show a disabled page in a Live Preview but not the disabled entries of this page?
Jonathan Schiffner
CC BY-SA 3.0
2016-07-02T16:22:47.093Z
`.status(null)` controls whether it will grab disabled entries or not, so you can take that out if you only want enabled. But if you do that, then this whole thing is pointless because that's the default behavior.
Brad Bell
CC BY-SA 3.0
2016-07-03T12:56:03.500Z
Okay so in the Live Preview it is not possible to see if an matrix entry in a disabled page is activated or not?
Jonathan Schiffner
CC BY-SA 3.0
2016-07-04T03:45:47.567Z
I guess I'm not following. What's a "matrix entry"?  Do you mean you want to check if a Matrix custom field has a block that is disabled on a Live Preview request?
Brad Bell
CC BY-SA 3.0
2016-07-04T11:21:29.177Z
Oh sorry! Yes, that is what I mean.
Jonathan Schiffner
CC BY-SA 3.0
2016-07-04T16:23:24.793Z
You're probably running into this bug, then: http://feedback.craftcms.com/forums/285224-bugs/suggestions/11307681-disabled-matrix-blocks-still-display-in-live-previ
Brad Bell
CC BY-SA 3.0
2016-07-01T18:26:27.877Z
2016-07-01T18:26:27.877Z
Brad Bell
<p>You can combine <code>.status( null )</code> with the <code>isLivePreview</code> property on <code>craft.request</code>. More info can be found in the <a href="https://craftcms.com/docs/templating/craft.request#isLivePreview" rel="nofollow">docs</a>.</p>

CC BY-SA 3.0
2016-05-22T13:42:53.837Z
Yes I know, but so I see in the Live Preview also the entry's which are disabled. 
But I want to see in the Live Preview the page(whether it's disabled or not) and only the enabled entry's. You know what I mean?
Jonathan Schiffner
CC BY-SA 3.0
2016-05-22T22:41:14.230Z
Jonathan: it sounds like you have other issues?  The live preview will work on any entry, disabled or not, as long as it has a template associated with it. Your template code determines what happens when you want to show other entries.  If your live preview isn't working, the template code on that page might be throwing an error, which may be why you're not getting the live preview.
RitterKnight
CC BY-SA 3.0
2016-05-24T19:45:23.940Z
Sorry I see you can misunderstand my question. I just updated it
Jonathan Schiffner
CC BY-SA 3.0
2016-05-21T21:05:40.897Z
2016-05-21T21:05:40.897Z
Luke Pearce
<p>Jonathan, you have a lot going on with your code, including nested for loops,  which is probably beyond the scope of the Q&amp;A format here.</p>

<p>If it were me, I'd try to simplify what you have until you get the basics working.  If Live Preview isn't working, there's probably other things going on with your code.</p>

<p>Make a copy of your code and do a simple <code>for</code> loop just to start for troubleshooting:</p>

<pre><code>&lt;ul&gt;
{% for currentEntry in craft.entries.section('aboutus') %}
    &lt;li&gt;{{currentEntry}}&lt;/li&gt;
{% endfor %}
&lt;/ul&gt;
</code></pre>

<p>That will spit out the title of the entry and only display the entries that are enabled. If that works, then you keep building up from there until you find the source of what's going on.</p>

CC BY-SA 3.0
2016-06-08T11:21:05.353Z
Thanks for your answer! I tried your code and it's the same result. If the page is `enabled` I can see the first entry. If the page is `disabled` I can't see anything. An idea what the error can be?
There is also nothing in the error log.
Jonathan Schiffner
CC BY-SA 3.0
2016-05-25T20:39:19.520Z
2016-05-25T20:39:19.520Z
RitterKnight
<p>The whole page is disabled in the backend. Like in this screenshot: <a href="https://i.sstatic.net/bKaXe.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bKaXe.png" alt="enter image description here"></a></p>

<p>Now I can't see anything in the Live Preview. </p>

<p>My code starts with: <code>{% for entry in craft.entries.section('aboutus') %}</code></p>

<p>If I set <code>.status(null)</code> I see everything in the Live Preview, but also the entries which are disabled.</p>

<p>So is it possible to show a disabled page in a Live Preview but not the disabled entries of this page?</p>

<p><strong>UPDATE</strong></p>

<p>In the Live Preview I can see all outside of this for loop <code>{% for entry in craft.entries.section('aboutus') %}</code> but nothing inside.</p>

<p>I uploaded my code <a href="http://jsfiddle.net/zoy2hj0c" rel="nofollow noreferrer">here</a>.</p>

CC BY-SA 3.0
2016-05-24T23:09:05.847Z
Is ``entry`` your actual variable? Craft actually defines ``entry`` as the current entry so if you're trying to use some of the current entry's data inside the loop, you'll get whatever entry the ``for`` loop is iterating over (and possibly a syntax error).  You might want to change that to ``aboutUsCurrentEntry`` or something. I know Live Preview uses the ``entry`` variable as well so you might be bumping up against a conflict there...
RitterKnight
CC BY-SA 3.0
2016-05-25T18:08:41.013Z
Thanks, but this does not changes anything. Do you have an other idea?
Jonathan Schiffner
CC BY-SA 3.0
2016-05-25T18:09:38.290Z
It would help to show what code is in your for loop.
RitterKnight
CC BY-SA 3.0
2016-05-25T18:13:42.310Z
I uploaded it here: https://jsfiddle.net/zoy2hj0c/
Jonathan Schiffner
<templating><live-preview>
Show Live Preview even if whole page is disabled
# Show Live Preview even if whole page is disabled

(Asked by: username_0 on 2016-05-21)

The whole page is disabled in the backend. Like in this screenshot: [![enter image description here](https://i.sstatic.net/bKaXe.png)](https://i.sstatic.net/bKaXe.png)

Now I can't see anything in the Live Preview.

My code starts with: `{% for entry in craft.entries.section('aboutus') %}`

If I set `.status(null)` I see everything in the Live Preview, but also the entries which are disabled.

So is it possible to show a disabled page in a Live Preview but not the disabled entries of this page?

**UPDATE**

In the Live Preview I can see all outside of this for loop `{% for entry in craft.entries.section('aboutus') %}` but nothing inside.

I uploaded my code [here](http://jsfiddle.net/zoy2hj0c).

**Tags:** templating, live-preview
> **Comments:**
> **username_1**: Is ``entry`` your actual variable? Craft actually defines ``entry`` as the current entry so if you're trying to use some of the current entry's data inside the loop, you'll get whatever entry the ``for`` loop is iterating over (and possibly a syntax error).  You might want to change that to ``aboutUsCurrentEntry`` or something. I know Live Preview uses the ``entry`` variable as well so you might be bumping up against a conflict there...  
> **username_0**: Thanks, but this does not changes anything. Do you have an other idea?  
> **username_1**: It would help to show what code is in your for loop.  
> **username_0**: I uploaded it here: https://jsfiddle.net/zoy2hj0c/  

---

## 3 answers

### Answer by username_2 on 2016-07-01. Score: 2 | Accepted answer

This should do it:

    {% if craft.request.isLivePreview() %}

        {# if it's Live Preview, grab even the disabled entries #}
        {% set entries = craft.entries.section('mySection').status(null).find() %}

    {% else %}

        {# not Live Preview, so just grab enabled entries #}
        {% set entries = craft.entries.section('mySection').find() %}

    {% endif %}

    {% for entry in entries %}
        {{ entry.title }}
    {% endfor %}

> **Comments:**
> **username_0**: Thanks for your answer! Now I see everything in the Live Preview, but also the entries which are disabled. So is it possible to show a disabled page in a Live Preview but not the disabled entries of this page?  
> **username_2**: `.status(null)` controls whether it will grab disabled entries or not, so you can take that out if you only want enabled. But if you do that, then this whole thing is pointless because that's the default behavior.  
> **username_0**: Okay so in the Live Preview it is not possible to see if an matrix entry in a disabled page is activated or not?  
> **username_2**: I guess I'm not following. What's a "matrix entry"?  Do you mean you want to check if a Matrix custom field has a block that is disabled on a Live Preview request?  
> **username_0**: Oh sorry! Yes, that is what I mean.  
> **username_2**: You're probably running into this bug, then: http://feedback.craftcms.com/forums/285224-bugs/suggestions/11307681-disabled-matrix-blocks-still-display-in-live-previ  

---

### Answer by username_3 on 2016-05-21. Score: 2

You can combine `.status( null )` with the `isLivePreview` property on `craft.request`. More info can be found in the [docs](https://craftcms.com/docs/templating/craft.request#isLivePreview).

> **Comments:**
> **username_0**: Yes I know, but so I see in the Live Preview also the entry's which are disabled.  But I want to see in the Live Preview the page(whether it's disabled or not) and only the enabled entry's. You know what I mean?  
> **username_1**: Jonathan: it sounds like you have other issues?  The live preview will work on any entry, disabled or not, as long as it has a template associated with it. Your template code determines what happens when you want to show other entries.  If your live preview isn't working, the template code on that page might be throwing an error, which may be why you're not getting the live preview.  
> **username_0**: Sorry I see you can misunderstand my question. I just updated it  

---

### Answer by username_1 on 2016-05-25. Score: 1

Jonathan, you have a lot going on with your code, including nested for loops,  which is probably beyond the scope of the Q&A format here.
If it were me, I'd try to simplify what you have until you get the basics working.  If Live Preview isn't working, there's probably other things going on with your code.
Make a copy of your code and do a simple for loop just to start for troubleshooting:

{% for currentEntry in craft.entries.section('aboutus') %}
    {{currentEntry}}
{% endfor %}


That will spit out the title of the entry and only display the entries that are enabled. If that works, then you keep building up from there until you find the source of what's going on.

> **Comments:**
> **username_0**: Thanks for your answer! I tried your code and it's the same result. If the page is `enabled` I can see the first entry. If the page is `disabled` I can't see anything. An idea what the error can be? There is also nothing in the error log.  

---

