Support » Themes and Templates » next_posts_link and previous_posts_link malfunction

  • Hi all,

    My issue is that next_posts_link and previous_posts_link works on the category page but not on the customized recent blogs page. It shows only the recent 5 posts and displays the same even if I click on older or newer entries link. Plz help. Here is the code for recent blogs custom page

    <?php query_posts("posts_per_page=5"); ?>
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    			<h4><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4>
    			<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
    			<div class="entry">
    				<?php the_excerpt(); ?>
    	<?php endwhile; ?>
    	<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
    	<?php else : ?>
    		<h2>Not Found</h2>
    	<?php endif; ?>

    And nav.php code is

    <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>

    I ‘d appreciate any help.

    Thanks and have a nice day>

Viewing 1 replies (of 1 total)
  • The problem is actually quite easy to solve if you know where to look. Since the query_posts()-function returns your posts, it also needs the paged-parameter.
    Try this :
    After “<?php ” insert “global $query_string;” .
    I’m not entirely sure, but I think you can just change “query_posts(“posts_per_page=5″)” to “query_posts($query_string . “&posts_per_page=5″)” to make it work after this change.

    Hope I could help.

Viewing 1 replies (of 1 total)
  • The topic ‘next_posts_link and previous_posts_link malfunction’ is closed to new replies.