Title: query_posts question
Last modified: August 19, 2016

---

# query_posts question

 *  [rubien](https://wordpress.org/support/users/rubien/)
 * (@rubien)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/query_posts-question-4/)
 * Hey, so this is kinda advanced.. I added a query post function so the posts show
   up by custom field date instead of the actual publish date. And I want all the
   old posts to be hidden so I added a todaysdate line the whole thing looks like
   this:
 * `query_posts('showposts=20&category_name=events&meta_key=date&meta_compare=>&
   meta_value=' . $todaysDate . '&orderby=meta_value&order=ASC');`
 * now on a subpage I want to do the listening a bit different but I can’t figure
   out how.
    I still want to show all posts that are in the categorie events, my
   meta key should be now location and I just want to see locations with the meta
   value “XY” … but the order of the posts still should be done by meta_key=date
   and not location. How can I do that? So I have to figure out how I can define
   2 different meta_keys in this command.. one for ordering and one for filtering…
   and then all the events that are older than todaysdate have to be hidden.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Safirul Alredha](https://wordpress.org/support/users/zeo/)
 * (@zeo)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/query_posts-question-4/#post-1830414)
 * Is this what u looking for? [http://scribu.net/wordpress/advanced-metadata-queries.html](http://scribu.net/wordpress/advanced-metadata-queries.html)
 * If yes, WP 3.1 Heh.
 *  Thread Starter [rubien](https://wordpress.org/support/users/rubien/)
 * (@rubien)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/query_posts-question-4/#post-1830441)
 * not really. Another thing that I noticed is that all my 2011 $date posts do not
   show up. any idea?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘query_posts question’ is closed to new replies.

## Tags

 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [rubien](https://wordpress.org/support/users/rubien/)
 * Last activity: [15 years, 5 months ago](https://wordpress.org/support/topic/query_posts-question-4/#post-1830441)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
