Can I limit # of Posts on Homepage?

  • Author
    Posts
  • #124767

    admint3219423
    Member
    Original poster

    I’m suddenly having trouble again with extra posts on the homepage. I would really like to limit the number of posts that show automatically when first going to the site, i.e. just sticky posts and then limiting to 9. It was working, then I wrote another post today and now that post is showing up at the bottom as #10, even though it is not a sticky and the settings state show only 9 at most. Any ideas?

    The blog I need help with is: isaachunterthewriter.com

    #124885

    mmcalister
    Theme Author

    Hi there,

    How many posts do you have set to show on the homepage? If you go to Settings > Writing > Content Types > Blog posts, what do you have there? You can control the number of posts shown with that.

    #124886

    admint3219423
    Member
    Original poster

    Hi,

    Thanks for responding. I checked Settings > Writing > Content Types, but there is no Blog posts listed there. The only setting I’ve found is in Settings > Reading > Blog pages show at most (it’s set for 9 posts).

    #124887

    admint3219423
    Member
    Original poster

    Seems to happen when I drop below 10. I just went through and started at 15, then updated it by dropping one post back to 9. It worked on all of them until I went to 9. At 9 it shows 10 posts. I tried setting it to 3 posts and it still shows 10.

    #124888

    admint3219423
    Member
    Original poster

    The functionality isn’t working as I hoped. I created 2 more duplicate posts so there would be a total of 12 posts on the page. But when I add a new post for today, it ignores the 12 post limit and adds the new post as a 13th post.

    I was hoping I could limit the number of posts on the home page to an exact number all the time, or limit it to just a specific category.

    #124890

    admint3219423
    Member
    Original poster

    I did find the settings > writing > blog posts. It’s in the new format. Same functionality as the old format. I can get it back down to 12 (or, more than 9), but when there is a new post created, it ignores the limit rule and displays the new post on the homepage.

    Is there any way to set the homepage to just display just one category?

    #125086

    mmcalister
    Theme Author

    Hi there,

    Apologies for the delay, it looked like this ticket was marked resolved.

    After doing a little hunting, it looks like the Infinite Scroll posts per page is different from the standard posts per page found in the settings.

    Unfortunately, it looks like the only way to override the default posts per page being output is to add a code snippet to your site. It looks like you do have the option to add custom themes and plugins. What you could do is add a snippet via a child theme.

    You would be looking to add this snippet to the functions.php file in your child theme. You can adjust the posts_per_page setting to whatever you’d like.

    function publisher_custom_infinite_scroll_setup() {
        add_theme_support( 'infinite-scroll', array(
            'posts_per_page' => 10,
        ) );
    }
    add_action( 'after_setup_theme', 'publisher_custom_infinite_scroll_setup' );

The topic ‘Can I limit # of Posts on Homepage?’ is closed to new replies.