title: Wordpress - Sorting posts by expiry date
body: <p>I'm trying to show expired posts AFTER non-expired posts. How can I do this?</p>
  
  <p>I've added a custom field "Expiration Date", in which I store the expiration dates in yyyy/mm/dd format. Problem is, if I order my results by this field, future expiry dates come first.</p>
  
  <p>So I created a repeating cron-job which compares the dates and creates a secondary custom field "Expiration Date Passed" for posts whose dates have passed. I tried ordering by this field, but WP only shows posts with a value for this field - IE posts with no expiry date, or expiry dates in the future, don't show. So I tried auto-adding values '99999999' for any post which haven't expired yet. Problem is, WP can't order by custom field values THEN date- IE the first posts with value '99999999' are in a random order.</p>
  
  <p>I also tried doing two queries for posts, one without expired posts, one with, then merging these two arrays. So the data is in the right order - but it screwed up WP's pagination.</p>
  
  <p>Help, I'm running out of ideas!</p>