Title: Using query_posts() function
Last modified: August 18, 2016

---

# Using query_posts() function

 *  [paulgobble](https://wordpress.org/support/users/paulgobble/)
 * (@paulgobble)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/using-query_posts-function/)
 * Can anyone spot what I’m doing wrong? Take a look at this Page
 * [http://www.sbox.net/blogrd105/?page_id=126](http://www.sbox.net/blogrd105/?page_id=126)
 * I’m building a custom Page template. I’m trying to use query_posts() with a custom
   query string, like this
    `<?php $testDate = ''2005-02-23 23:59:59''; ?> <?php
   $theQuery = ''post_date>' . $testDate . '''; ?> <?php query_posts($theQuery);
   Â ?>
 *  Without our using string variables, the code would look like this
    `<?php query_posts('
   post_date >= '2005-02-23 23:59:59''); ?>`
 * So far, I haven’t been able to format the parameter for query_posts() properly–
   at least that’s my theory. What am I doing wrong?

Viewing 1 replies (of 1 total)

 *  Thread Starter [paulgobble](https://wordpress.org/support/users/paulgobble/)
 * (@paulgobble)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/using-query_posts-function/#post-155300)
 * Some of my quoting is being changed in the post above. Some of those double/tripple
   quotes are escaped single quotes.

Viewing 1 replies (of 1 total)

The topic ‘Using query_posts() function’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [paulgobble](https://wordpress.org/support/users/paulgobble/)
 * Last activity: [21 years, 3 months ago](https://wordpress.org/support/topic/using-query_posts-function/#post-155300)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
