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.

  • 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 '16 at 20:50
  • Done. I hope this helps – Jonathan Schiffner May 17 '16 at 21:03
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.

  • This works, but now the page is shown in the frontend even if it is disabled. – Jonathan Schiffner May 18 '16 at 8:52
  • Is there any way to show the entry only in the Live Preview and not on the real page? – Jonathan Schiffner May 20 '16 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 '16 at 18:30
  • Yes this is what I'm searching for. – Jonathan Schiffner May 21 '16 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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