I have an 'Expired' date field that holds the date when a node expires. However, not every node has this field so nodes missing this field come after nodes containing the field. I want nodes that do not have this field to be sorted above nodes that have the field. How can I do this?

1 Answer 1


You would need to sort your posts by two criteria

  • Has a expired date
  • The value of the expired date

Or alternatively you could use ASC/DESC to display those without an expire date first. Doing that would effect the sorting of the rest of the nodes.

If you want to use two criteria, you could create a computed CCK field that has a value of 0/1 indicating if it has an expire date. You can use that to display all nodes without expire date first, and then sort those with an expired date by the expired date.


Your Answer

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

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