• Resolved Jacorre

    (@jacorre)


    Just a quick question and not sure if this is a bug or just the way it’s supposed to work?

    Let’s say I have set the number of posts to display in the admin section under Reading to 5. That means that 5 posts will display at the most.

    Now if I make a post a sticky post, that post will display first on the homepage. The number of posts on the homepage change to 6 (not 5).

    Is there a way around that?

Viewing 3 replies - 1 through 3 (of 3 total)
  • That is the way it is intended to work.

    A query_posts() call can be made to ‘not include’ stickies with the caller_get_posts=1 argument.

    Thread Starter Jacorre

    (@jacorre)

    I want the sticky to appear but don’t want it to increase the number of posts displaying on the homepage.

    I found the answer by using a conditional statement.

    I want 9 posts to display at all times. But when using a sticky on the homepage it would increase the post count to 10. So what I did was use the following just before the loop:

    <?php if (is_home()) {
    query_posts(‘showposts=8’);
    }?>

    That way it shows 8 (plus the 1 sticky) making the total 9 on the homepage. The rest of the pages will use the default setting in the admin panel which is 9.

    Hope this helps others as well! Thanks!

    Thread Starter Jacorre

    (@jacorre)

    I was wrong, this doesn’t work as I expected. It broke something else. When clicking to go to page 2 or higher, it doesn’t work well. So I’m back to just letting the homepage list 10 when a sticky is used and other pages list 9 as set in the admin reading options.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Number of posts wrong on homepage when using sticky post’ is closed to new replies.