• I’ve put the links before the else and endif statements of the loop, and clicking previous entries reloads the page with paged=2, but it still shows the 5 newest entries.

    <?php next_posts_link(‘Previous Entries’) ?> <?php previous_posts_link(‘Next Entries’) ?>

    Before the loop I set the number of posts to be displayed: <?php query_posts(‘posts_per_page=5’); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Orabidoo

    (@orabidoo)

    Update: I removed <?php query_posts(‘posts_per_page=5’); ?> and now I can view different categories and single posts by clicking the links. But how can I set the loop to only display five posts?

    You need to use the ‘paged’ parameter in the query:

    <?php $paged = (intval(get_query_var('paged'))) ? intval(get_query_var('paged')) : 1;
    query_posts('posts_per_page=5&paged='.$paged); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘next_posts_link doesn’t work’ is closed to new replies.