Forums

[resolved] Show # of posts tag? (want archive to show more posts than home page) (3 posts)

  1. tdellaringa
    Member
    Posted 4 years ago #

    It looks like both my archives and my categories both use the archive.php template, which is great because I want them to look and work the same.

    The problem is setting reading # of posts in reading options affects both the home page and the archives. I only want one post to show up on the home page, but 10 on the cat/archive pages. But there is only one setting.

    I know I could make custom templates for each category but that seems like going about it the wrong way when I already have perfectly good templates in place.

    I thought there was a tag or conditional statement I could use in a template to control/override that specific page and determine how many posts I want to show up (I thought I did this in previous versions of WP)

    My searches have come up empty in the docs though - does such a thing exist?

  2. Jeremy Clark
    Moderator
    Posted 4 years ago #

    Set your reading options to 1 then on the archives.php file look for this code
    <?php while (have_posts()) : the_post(); ?>

    Add this before that
    <?php query_posts('showposts=10'); ?>

  3. tdellaringa
    Member
    Posted 4 years ago #

    Perfect! That was it - thank you so much.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags