• I’m using a static homepage with custom page templates on each page for a portfolio website. I’m working on the blog page, and everything works except for pagination. Someone else had this same problem but their previous and next buttons were leading to 404s. Mine work, but they don’t change the posts. Meaning, it will recognize that it has gone to page 2, but the same posts that were on page 1 are still displayed.

    I have multiple loops running, and I thought that might be the problem, but when the other loop was removed, it was the same.

    Here’s my code

    <?php
    	query_posts("category_name=blog-post&posts_per_page=2" . '&order=dec');
    	if ( have_posts() ) : while ( have_posts() ) : the_post();
     	if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    
    	<div class="entry">
            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
            <div class="entrycontent"><?php
                global $more;
                $more = 0;
                the_content('Read more...'); ?>
            </div>
            <img src="" alt="whatever" />
        </div>
    
    	<?php endwhile; ?>
    
        <div class="navigation">
    		<div class="alignleft"><?php next_posts_link('&laquo;
    Previous Entries') ?></div>
    		<div class="alignright"><?php previous_posts_link('Next
    Entries &raquo;') ?></div>
    	</div>
    <?php endif; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Pagination on custom page template’ is closed to new replies.