WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] "older entries" link not working

[Resolved] "older entries" link not working

  • I see that many people are having the similar issue, but I could not find a solution for my issue.

    The link is working correctly, but I keep seeing the latest blog page (basically page doesn’t change) and it doesn’t go to page 2.
    Here is what I have in nav.php

    <div class="navigation">
    	<div class="next-posts"><?php next_posts_link('« Older Entries') ?></div>
    	<div class="prev-posts"><?php previous_posts_link('Newer Entries »') ?></div>
    </div>

    and here is what I have in blog template:

    <?php get_header();
    $cat = is_home() ? '&cat=-42' : '';
    if( ! ( $paged = get_query_var('paged') ) ) $paged = 1;
    query_posts( $query_string . '&posts_per_page=3&paged=' . $paged . $cat);
    ?>

    I’d appreciate it if someone could please suggest what I can do to solve this issue!

    Thanks.

    [Moderator Note: Please post code or markup snippets between backticks or use the code button.]

Viewing 2 replies - 1 through 2 (of 2 total)
  • You should check to see if $paged is being set correctly. Change your code to this:

    <?php get_header();
    $cat = is_home() ? '&cat=-42' : '';
    if( ! ( $paged = get_query_var('paged') ) ) $paged = 1;
    print_r("<p>PAGED:$paged</p>");
    query_posts( $query_string . '&posts_per_page=3&paged=' . $paged . $cat);
    ?>

    and see if $paged is set to anything other than 1. If not, you may need to use the ‘page’ query_var rather than ‘paged’.

    Thank you, now it is working.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] "older entries" link not working’ is closed to new replies.
Skip to toolbar