Forums

A problem with posts_per_page (2 posts)

  1. raphaelber
    Member
    Posted 2 weeks ago #

    Hi

    I tried using one example I found in the codex in order to fix the number of posts by page for a specific category.

    Usually the number of posts per page is fixed in the reading settings section of the dashboard.

    But thanks to a query, I should be able to change that number according to the category I want.

    I added a <?php query_posts('posts_per_page=9'); ?> just before the loop. I had the most recent 9 posts but when I clicked on older entries I got the same most recent 9 posts.

    Is posts_per_page working properly ?

    Thank you

  2. MichaelH
    moderator
    Posted 2 weeks ago #

    You need to add the 'pagination' stuff there

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($query_string .'posts_per_page=9&paged='.$paged);
    ?>

Reply

You must log in to post.

About this Topic