6

I have this in my listings template, but the 'pending' parameter does not seem to work.

{% set urlCat = craft.request.getSegment(3) %}
{% set category = craft.categories.slug( urlCat ) %}
{% set allEntries =  craft.entries.status('live, pending').section('sectionName').relatedTo(category).find() %}

This seems to only return 'live' entries even though I do have 'pending' specified. I've tried this several ways and cannot seem to make it work.

The strange thing is that this seems to work fine on my single entry page where I have:

{% set entry = craft.entries.section('sectionName').slug(selected).status("live, pending").first() %}

Any ideas? Thanks :)

  • Have you tried my answer, pixel? Setting status to null doesn't return only 'live' and 'pending' entries! – carlcs Aug 15 '14 at 12:59
4

You can get all entries regardless of status with .status(null):

{% set allEntries =  craft.entries.section('sectionName').relatedTo(category).status(null).find() %}
  • This will also show all 'disabled' and 'expired' entries though. – carlcs Jul 27 '14 at 20:28
3

Try to set both states in single/double quotes:

{% set allEntries = craft.entries.status('live', 'pending').section('sectionName').relatedTo(category).find() %}
1

For Craft CMS 3:

{% set allEntries = craft.entries.status('pending, live').section('sectionName').relatedTo(category).find() %}

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.