WP_Query display next custom post from today’s date

To sort based on a date field, you need to convert the date to a UNIX datetime format. It’s probably best to store the date in a separate custom field. I’ve never had to set this up, but you’d

  1. hook into save_post
  2. look for a custom field with the date in it
  3. convert that to a datetime in a different custom field (probably started with an underscore to hide it from the custom fields interface).
  4. Query for the hidden custom field and use it to sort.

There are also some custom meta box plugins that come with a date picker and the ability to store UNIX format dates.

To do the human-readable date to UNIX conversion, you’ll want to learn about PHP’s strtotime() function. To convert back (if you’re storing the UNIX date and want to print it in a human-readable format), you’ll use the date() function.