WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Show lastest post on home page but multiple posts on archive pages (5 posts)

  1. matharchod
    Member
    Posted 5 years ago #

    I'm trying to show the Latest Post on my home page but then show full lists of posts in my Archive and Search pages. I tried changing the "Settings > Reading" preferences, but that affects the entire site. Can I leave that set at, say, 10, but have only one (the latest) post show up on the home page?

  2. Asuka_Aki
    Member
    Posted 5 years ago #

    <?php get_header(); query_posts('posts_per_page=1'); ?>

    Change 1 to what ever number of posts you want to display. It doesn't change categories or archives.

  3. matharchod
    Member
    Posted 5 years ago #

    Thanks!

  4. spbitticks
    Member
    Posted 5 years ago #

    I could only get this to work properly after creating a home.php file that was an exact copy of my index.php file, except that I inserted the code as outlined above. There's a full description here:

    http://skdstudio.com/blog/how-to-make-wp-show-only-one-post-on-the-front-page

    Cheers!

  5. falcor200
    Member
    Posted 5 years ago #

    Hi the last post in this thread seemed to do what I needed having one post on the main page but 5 posts on tags and categories but now when I hit the previous and next post on the home page it just keeps showing the same post over and over instead of going back. Any ideas anyone?

Topic Closed

This topic has been closed to new replies.

About this Topic