Title: Display specified pages using query_posts
Last modified: August 19, 2016

---

# Display specified pages using query_posts

 *  [heyindy](https://wordpress.org/support/users/heyindy/)
 * (@heyindy)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/display-specified-pages-using-query_posts/)
 * Hi all,
 * I am using query_posts to display 4 of my portfolio items on my homepage. I’ve
   set my portfolio items up as seperate pages.
 * Currently I am using:
    `<?php query_posts(array('showposts' => 4, 'post_parent'
   => '159', 'post_type' => 'page')); ?>`
 * This works great, only could anyone tell me how I can display 4 specific posts
   as opposed to just the four latest?
 * Thanks

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

 *  Thread Starter [heyindy](https://wordpress.org/support/users/heyindy/)
 * (@heyindy)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/display-specified-pages-using-query_posts/#post-1720662)
 * I know you can use
    `'pagename' => 'about'` – note that this is not the page’s
   title, but the page’s path
 * But I want to display four posts.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/display-specified-pages-using-query_posts/#post-1720667)
 *     ```
       $args = array(
       'post__in' => array(5,12,2,14)
       );
       query_posts( $args) ;?>
       ```
   
 * [http://codex.wordpress.org/Function_Reference/query_posts#Post_.26_Page_Parameters](http://codex.wordpress.org/Function_Reference/query_posts#Post_.26_Page_Parameters)
 *  Thread Starter [heyindy](https://wordpress.org/support/users/heyindy/)
 * (@heyindy)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/display-specified-pages-using-query_posts/#post-1720672)
 * You legend esmi, it would help if I just read a little bit more on the page I’m
   on!

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

The topic ‘Display specified pages using query_posts’ 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/)
 * 3 replies
 * 2 participants
 * Last reply from: [heyindy](https://wordpress.org/support/users/heyindy/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/display-specified-pages-using-query_posts/#post-1720672)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
