• Resolved greenpixels

    (@greenpixels)


    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 instead]

    I hope someone can help me with this. Thanks a lot in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hmmm. Choosing to show 6 posts wouldn’t get you what you want (5+1=6)?

    Thread Starter greenpixels

    (@greenpixels)

    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

    Thank you very much!

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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

    Thread Starter greenpixels

    (@greenpixels)

    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.