1

When the entry is disabled, the Live Preview only shows things which are outer of the main loop. This is a part of my code:

{% include "header.html" %}
{% for entry in craft.entries.section('flashback') %}
    <section id="intro" style="background-image: url('{{ entry.heroImage.first().getUrl() }}');">
        <h1>Flashback</h1>
    </section>
...
{% endfor %}
{% include 'footer.html' %}

The header and the footer are visible but the section and headline not.

2
  • Can you elaborate with a bit more template code? "outer of the main loop" sounds like some things are displaying outside of a loop and things inside aren't? It'd be helpful to point out exactly what's happening in the code and what you're expecting to see.
    – Brad Bell
    May 17, 2016 at 20:50
  • Done. I hope this helps May 17, 2016 at 21:03

1 Answer 1

3

Change:

{% for entry in craft.entries.section('flashback') %}

To:

{% for entry in craft.entries.section('flashback').status(null) %}

The 2nd one will grab all entries regardless of their enabled/disabled status.

4
  • This works, but now the page is shown in the frontend even if it is disabled. May 18, 2016 at 8:52
  • Is there any way to show the entry only in the Live Preview and not on the real page? May 20, 2016 at 10:50
  • Not sure I'm following, but it sounds like you might need to wrap some of your template logic in a if craft.request.isLivePreview() conditional?
    – Brad Bell
    May 20, 2016 at 18:30
  • Yes this is what I'm searching for. May 21, 2016 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.