Title: query_posts
Last modified: August 19, 2016

---

# query_posts

 *  Resolved [greenpixels](https://wordpress.org/support/users/greenpixels/)
 * (@greenpixels)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/query_posts/)
 * Hi, I am new to wordpress and php, so I hope you can help me.
    I want to create
   a new page which shows the last 5 posts (beside the latest one, which is shown
   in the index.php-i choose 1 post per page in the options menu of the admin panel)
 * I searched and tried the
    `<?php query_posts('showposts=5'); ?>`
 * but still it does not work.
 * My full code looks like this:
 * [Code moderated: Use [http://wordpress.pastebin.ca](http://wordpress.pastebin.ca)
   instead]
 * I hope someone can help me with this. Thanks a lot in advance.

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

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/query_posts/#post-666645)
 * Hmmm. Choosing to show 6 posts wouldn’t get you what you want (5+1=6)?
 *  Thread Starter [greenpixels](https://wordpress.org/support/users/greenpixels/)
 * (@greenpixels)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/query_posts/#post-666686)
 * Thanks for the reply.
    What I want is a new page, where I can display the last
   5 posts, besides the latest one (because this will be shown in the index page).
 * I hope I am in the right track to use the query code.
 * I uploaded the code to this site [http://wordpress.pastebin.ca/816212](http://wordpress.pastebin.ca/816212)
 * Thank you very much!
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 5 months ago](https://wordpress.org/support/topic/query_posts/#post-666688)
 * > _What I want is a new page, where I can display the last 5 posts, besides the
   > latest one (because this will be shown in the index page)._
 * Do you mean to show the last 5 posts BEFORE the latest one? Your use of the word“
   besides” is confusing, because we are talking about web design here and it seems
   like you want to place 5 posts beside (as in to the left or right of) the first
   one, showing 6 on one page.
 * If you are talking about getting 5 posts excluding the latest post, then you 
   would use this:
    `query_posts('showposts=5&offset=1');`
 * [http://codex.wordpress.org/Template_Tags/query_posts#Offset_Parameter](http://codex.wordpress.org/Template_Tags/query_posts#Offset_Parameter)
 *  Thread Starter [greenpixels](https://wordpress.org/support/users/greenpixels/)
 * (@greenpixels)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/query_posts/#post-666704)
 * Yes, that’s what i mean. thanks for the link.

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

The topic ‘query_posts’ is closed to new replies.

## Tags

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

 * 4 replies
 * 3 participants
 * Last reply from: [greenpixels](https://wordpress.org/support/users/greenpixels/)
 * Last activity: [18 years, 5 months ago](https://wordpress.org/support/topic/query_posts/#post-666704)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
