Forums

[resolved] Varying number of posts for different pages? (2 posts)

  1. nickoreardon
    Member
    Posted 11 months ago #

    Hello, not sure if I'm posting this in the right place or not, oh well.

    I've been searching for a while, but cant seem to find the solution, so I'm looking for some help, or at least a pointer in the right direction.

    I want to change the number of posts I want to display on different pages. For example, on the main page I want to display say 6 posts, but then on a page showing a certain category (I have built a custom page template for my category), I want to show 10.

    Obviously you can change the number of posts via the 'reading' settings, but that changes the number of posts for all pages, is there anyway around this?

    Thanks.

  2. nickoreardon
    Member
    Posted 11 months ago #

    Just found out how to do it:

    Stick this in the loop -

    <?php static $ctr = 0;
    if ($ctr == "X") { break; }
    else { ?>

    <?php $ctr++; } ?>

    --

    Change the 'X' to the number of posts you want to display.

Reply

You must log in to post.

About this Topic

Tags