WordPress.org

Ready to get started?Download WordPress

Forums

DIsplay lastest 3 posts (7 posts)

  1. stiwdio
    Member
    Posted 2 years ago #

    Hi, I have the following code, in my page template, but it keeps displaying all the posts, could someone show me how just to have a maximum of 3 posts?

    Thanks for your help

    [code moderated - please follow the forum guidelines for posting code]

  2. stiwdio
    Member
    Posted 2 years ago #

    Sorry guys code was moderated, heres the link to the code;

    http://pastebin.com/z8Yyr7KJ

    Thanks for any help
    Darren

  3. keesiemeijer
    moderator
    Posted 2 years ago #

    Try setting 'posts_per_page' => $tz_blog_number to three:

    'posts_per_page' => 3

  4. stiwdio
    Member
    Posted 2 years ago #

    Worked like a treat! Thank you keesiemeijer!!!

  5. stiwdio
    Member
    Posted 2 years ago #

    Further to the last, is there a way of making the above code select onlt category 6 posts, have tried adding a new line 'cat' = 6

  6. keesiemeijer
    moderator
    Posted 2 years ago #

    That should be 'cat' => 6. Try changing your query to this:

    $query = new WP_Query(array(
    'orderby' => $tz_blog_order,
    'posts_per_page' => 3,
    'cat' => 6
    )
    );
  7. stiwdio
    Member
    Posted 2 years ago #

    I was close, Once again worked brillaintly! thank you again! :-)

Topic Closed

This topic has been closed to new replies.

About this Topic