Support » Fixing WordPress » How do I limit blog posts to 1 page

  • Please help, I’m new and have very little coding knowledge. I am using a static page as my front page, and another page as my blog page for the most recent articles using just the default template. My problem is that I can set how many posts to show up per blog page ( I chose 7), but all of my posts are showing up over multiple pages. I only want readers to see the most recent articles on 1 blog page and then go to the category archives if they want to read more. Can someone please tell me exactly what to do? I’ve read about the loop and queries but am very confused about how to fix this as I don’t want every article I ever write to stay on my Blog page 🙂
    If I’ve rambled and I’m not clear, I apologize, maybe taking a look at the site will help

Viewing 3 replies - 1 through 3 (of 3 total)
  • Is something like this what you are looking for?

    Put the following on your PHP file prior to The Loop:

    $query_string .= "&paged=1&posts_per_page=1";
    $query_posts( $query_string );

    Which will only retrieve the latest post. Then just remove the navigation link and you will get one post on the page. Check out query_posts for more information.

    Thanks for the reply, this is close to what I am looking for. I would like the last 5 posts to appear on the blog page.
    Please excuse my ignorance, but I don’t know which PHP file to even enter the code into to specifically alter the blog page. When I go to the Manage File or Theme editor sections in the Admin Panel, the only php file I see with the navigation code on it is the archive.php file. I don’t think that this is the one I want? Any idea which file? I see a file for the main index template or a page template file but I don’t think that they are the right files either.

    It depends on the theme that you are using, but a good place to start would be the Main Index Template. This is the one that would get used unless there are other files in the theme that would supersede it.

    See Template Hierarchy for more information.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I limit blog posts to 1 page’ is closed to new replies.