1

Craft 3.0.37

I have the following code which I expect to output all entries (live and pending) but it doesn't

<ul>
  {% for entry in craft.entries.section('podcast').status('live','pending').relatedTo(season).orderBy('postDate', 'asc').all() %}
    <li ><span>{{ entry.episodeNumber }}</span> <a href="{{ entry.url }}"> {{ entry.title }}</a></li>
  {% endfor %}
</ul>

If I change the status to only pending it outputs pending entries, if live, outputs live. However it will not output both pending and live.

Please advise.

1

Use status(['live','pending']) to get all entries with both states.

Later, to get the linked entry you need to setup a custom route like `podcasts/{slug}. In the template you query the entry like this:

{% set slug = craft.request.lastSegment() %}
{% set entry = craft.entries.slug(slug).status(['live', 'pending']).one() %}

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.