WordPress.org

Ready to get started?Download WordPress

Forums

Display latest 5 posts from a category with sticky posts at the top (1 post)

  1. c.bavota
    Member
    Posted 4 years ago #

    I am trying to display 5 posts from a specific category that includes sticky posts and normal posts. I want the sticky posts to display first, and then the rest.

    I have read all the codex in regards to sticky posts and I know that this:
    $posts = array(
    "showposts"=>5,
    "cat"=>1,
    "post__in" => get_option("sticky_posts"),
    "caller_get_posts" => 1
    );

    Will display 5 sticky posts from the category with the ID "1". If 5 sticky posts are available they will be displayed. If not, it will just display however number of sticky posts have been set and ignore normal posts.

    How can I make it display 5 posts from that category with sticky posts at the top?

Topic Closed

This topic has been closed to new replies.

About this Topic