[resolved] Custom page template previous/next links don't work (5 posts)

  1. annehill
    Posted 4 years ago #

    I had someone create a custom page template for a category archive. One thing has never worked on it though: if you try to navigate to the 2nd or 3rd page of archives, it keeps calling the same (most recent) page. So all my previous podcasts (that's the post category) are essentially hidden from view.

    Here's the navigation part of the page template:

    <div class="navigation">
    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
    <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
            <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
            <?php } ?>

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

    And here's the actual link on my site:


    Anyone know what the nav is missing?


  2. Michael
    Forum Moderator
    Posted 4 years ago #

    the cause is usually not the 'next/prev' code, but something at the start of the loop;

    can you paste the full code of the template into a http://pastebin.com/ and post the link to it here?


  3. annehill
    Posted 4 years ago #

    Sure, thanks for that. Here's the link:


  4. Michael
    Forum Moderator
    Posted 4 years ago #

    try and add the 'paged' parameter to this line:

    <? query_posts('cat=3'); ?>


    <?php query_posts('cat=3&paged='.get_query_var('paged')); ?>

    or, if that does not work, try:

    <?php query_posts('cat=3&paged='.get_query_var('page')); ?>
  5. annehill
    Posted 4 years ago #

    Fantastic--it works! Thanks so much.

Topic Closed

This topic has been closed to new replies.

About this Topic