WordPress.org

Ready to get started?Download WordPress

Forums

get posts tag and codex question (3 posts)

  1. Michael Bishop

    Posted 9 years ago #

    http://codex.wordpress.org/Template_Tags/get_posts
    I've seen a few questions recently regarding this feature, and when I look at the example in the codex it says show the first post and links to the previous five...but the first parameter is numberofposts=10. Is that a typo, or am I reading the codex wrong.

  2. moshu
    Member
    Posted 9 years ago #

    As far as I know this works with The Loop of 1.2.x version. Since 1.5 The Loop has been changed. See The Loop and The Loop in Action in the Codex. You can also see the various implementations of the query_posts as presented in many threads in the forum (it is preferred in WP 1.5 - at least that was my understanding)

  3. Michael Bishop

    Posted 9 years ago #

    No, I know the tag works, but if you look at the example at the codex, it says, as I say in my first post

    If you had your blog configured to show just one post on the front page, but you also wanted to show links and excerpts to the previous five with the category ID 1, you could use code like this:

    $posts = get_posts('numberposts=10&offset=1&category=1');
    number of posts=10, but you want to "show previous five".
    I'm confused. I just played with the code for someone wanting to have 3 posts, and then a list of 10 older. Which I did fine. I did a get_query post per page=3, and then the get_posts numberofposts13, offset=3. Which worked.
    Guess what I'm getting at is the text and the code don't match and I don't know who to notify, otherwise, I'm totally reading it wrong, and would like an explanation.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.