WordPress.org

Ready to get started?Download WordPress

Forums

Sticky posts break query_posts - posts_per_page (2 posts)

  1. AsgerB
    Member
    Posted 1 year ago #

    Hey guys!

    I've been trying to limit the number of posts displayed on the front page to 3.

    But query_posts( 'posts_per_page=3' ); only limits the number of non-sticky posts. The sticky posts are added to the loop, so if I have 1 sticky post it displays 4 posts on the front page.

    I've been trying to mess around with different settings, but can't seem to figure out how to only show 3 posts. I hope someone can help me?

    Best,
    Asger

  2. keesiemeijer
    moderator
    Posted 1 year ago #

    I altered the code from this topic to show only 3 posts on the home page: http://wordpress.org/support/topic/wordpress-34-broke-my-paginaton-setup?replies=24#post-2906422

    Remove the query_posts from your template and try it with this in your theme's functions.php: http://pastebin.com/KL7ZbXQg

Topic Closed

This topic has been closed to new replies.

About this Topic