I have an archive page template that I’ve built that has a successful navigation at the end of the loop. However, now I want to add an additional navigation at the top. However, after I copied and pasted the exact code, the ‘Previous Entries’ displays and links correctly, but ‘Next Entries’ never shows up as it does in the bottom navigation.
In my page-archive.php file, this is gist of my code:
<div class="navigation top">
<?php next_posts_link('Next Entries') ?> <!-- Doesn't appear to show up! -->
<?php previous_posts_link('Previous Entries') ?>
</div>
<?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("showposts=1&paged=$page");
while ( have_posts() ) : the_post() ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h3><a href="<?php the_permalink() ?>" ><?php the_title(); ?></a></h3>
<?php the_content(); ?>
</div>
<?php endwhile; ?>
<div class="navigation bottom">
<?php next_posts_link('Next Entries') ?>
<?php previous_posts_link('Previous Entries') ?>
</div>
I understand that a Page template is not the ideal method to create an archive page, so if there is a different method for producing a full customizable archive page, please inform me!
Currently, I’m using my home.php file to display static content, so the page-archive.php is a method to direct users to the actual “Blog” portion of the site.
Try to put this string:
to the very top of the page. You need to do that because
next_posts_link
andprev_posts_link
calls use some global variables set byquery_posts
call.