Title: query posts
Last modified: August 19, 2016

---

# query posts

 *  [ads1018](https://wordpress.org/support/users/ads1018/)
 * (@ads1018)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/query-posts-3/)
 * Alright, I figured out how to retrieve a particular post using the php query_posts
   function. This is what I put right before the loop as suggested by the codex:
 *     ```
       <?php
       query_posts('p=4');
       ?>
       ```
   
 * It works great. However, what I’d like to do now is retrieve a particular post
   _and_ my most recent post. Anyone know how to accomplish this using the query_posts
   function?

Viewing 1 replies (of 1 total)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/query-posts-3/#post-1216126)
 * Probably need two loops to do that. This article uses get_posts (same parameters
   as query_posts) to do that:
    [http://www.daobydesign.com/blog/2007/07/modifying-wordpress-front-page/](http://www.daobydesign.com/blog/2007/07/modifying-wordpress-front-page/)

Viewing 1 replies (of 1 total)

The topic ‘query posts’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [MichaelH](https://wordpress.org/support/users/michaelh/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/query-posts-3/#post-1216126)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
