Sticky posts break query_posts - posts_per_page (2 posts)

  1. AsgerB
    Posted 3 years 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?


  2. keesiemeijer
    Posted 3 years 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