title: expire wordpress posts in the query - not the loop
body: <p>I'm currently using the following code to expire and hide posts after my custom field 'date' in the loop (which works fine):</p>
  
  <pre><code>&lt;?php
  while (have_posts()) : the_post();
  //to check against expiration date;
  $currentdate = date("Ymd");
  $expirationdate = get_post_custom_values('date');
  if (is_null($expirationdate)) {
  $expirestring = '30005050'; //MAKE UN-EXPIRING POSTS ALWAYS SHOW UP;
  } else {
  if (is_array($expirationdate)) {
  $expirestringarray = implode($expirationdate);
  }
  $expirestring = str_replace("/","",$expirestringarray);
  } //else
  if ( $expirestring &gt;= $currentdate ) { 
  // post loop contents
  } ?&gt;
  </code></pre>
  
  <p>I would like to filter out the posts in the query instead - is this possible. I have a plugin that generates a google map from the results of the query, not the loop - anyone got any ideas? here's my current query</p>
  
  <pre><code>&lt;?php query_posts($query_string.'&amp;order=asc&amp;orderby=meta_value&amp;meta_key=date');
  if (have_posts()) : ?&gt;
  </code></pre>
  
  <p>I forgot to mention that the resulting posts should also be sorted by the same date field appearing with the closest date to now first.</p>