Custom template page navigation
-
Hi
I’m having problem with page navigation on my custom blog page template. I used
query_posts
to limit the loop to 5 posts andnext_posts_link
andprevious_posts_link
to navigate between pages. The navigation links led me to a new page, seen from the url/page/2/, but the page shows the same list of posts as the first page.I have tried few methods I found on the net including using
wp_query_reset
but to no avail.FYI, I also used
query_posts
on another pagehome.php
to show only the latest 3 posts without page navigation.Please help. Thanks.
Below is my page template
<?php get_header(); ?><div id="main-content">
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
<?php query_posts("posts_per_page=5", "paged={$paged}") ?><div id="featured_posts">
<?php if (have_posts()) : global $more; $more = 0; while (have_posts()) : the_post(); ?><div class="entry">
<div <?php post_class() ?> id="featured-posts-<?php the_ID(); ?>"><div class="entry_title"><h2>"><?php the_title(); ?></h2></div>
<div class="entry_head">
<span class="date"><?php echo get_the_date('');?></span>
<span class="category"><?php the_category(', ') ?></span>
<span class="comments"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></span>
</div><div class="entry_featuredimg img_shadow"><?php the_post_thumbnail(); ?></div>
<div class="entry_content">
<div class="entry_text"><?php the_content('<class="more">more...</span>', FALSE, ''); ?></div>
</div>
</div>
</div><?php endwhile; ?>
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
<?php wp_reset_query(); ?>
<?php else : ?>
<h2>Not Found</h2>
<?php endif; ?>
</div>
</div> <!-- END #main-content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
- The topic ‘Custom template page navigation’ is closed to new replies.