WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. annehill
    Member
    Posted 2 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 } ?>
    			</div>

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

    And here's the actual link on my site:

    http://annehill.org/dream-talk-radio/podcasts/

    Anyone know what the nav is missing?

    Thanks,
    Anne

  2. alchymyth
    Forum Moderator
    Posted 2 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?

    how-to

  3. annehill
    Member
    Posted 2 years ago #

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

    http://pastebin.com/gZrxGYQR

  4. alchymyth
    Forum Moderator
    Posted 2 years ago #

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

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

    example:

    <?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
    Member
    Posted 2 years ago #

    Fantastic--it works! Thanks so much.

Topic Closed

This topic has been closed to new replies.

About this Topic