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
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.
-
I used drupal.org/project/views_customfield but it's the same idea Aug 6, 2011 at 22:43