• Awhile back I added a special pagination code from here http://design.sparklette.net/teaches/how-to-add-wordpress-pagination-without-a-plugin/ to my site. It worked great but as I continued to build my site the pagination stopped working. I have deactivated all plugins and it still doesn’t work. All it does is go to page 2 but still shows page 1 content. Any ideas?

    Here’s my main code:

    <?php
    
    /*
    Template Name: Blog Homepage
    */
    
    ?>
    
    <?php get_header(); ?>
    
    	<div id="container"> <!-- BEGIN MAIN CONTENT CONTAINER -->
    		<div id="sidebar">
    		<?php get_search_form(); ?>
    			</div><!-- END searchbar -->
    
    	<div id="blogContent"> <!-- START BLOG CONTENT -->
    
    <?php query_posts("posts_per_page=3"); ?>
    
    	<?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
    				global $more;
    				$more = 0;
    				?>
    
    				<?php the_post_thumbnail( 'my_custom_thumbnail'); ?>
    
    				<?php the_excerpt(); ?>
    
    			</div>
    <?php $odd_or_even = 'odd'; ?>
    			<div class="DATE<?php echo $odd_or_even; ?>">
    				<?php $odd_or_even = ('odd'==$odd_or_even) ? 'even' : 'odd'; ?>
    
    				<p class="DATEtext"><?php echo date("M j $upperCase"); ?>
    				        </p>
    			</div>
    		</div>
    
    	<?php endwhile; ?>
    
    	<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
    
    	<?php else : ?>
    
    		<h2>Not Found</h2>
    
    	<?php endif; ?>
    
    			<?php if (function_exists("pagination")) {
    		    pagination($additional_loop->max_num_pages);
    		} ?>
    
    		</div> <!-- END BLOG CONTENT -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    If it makes a difference I am using these plugins: NextGEN gallery, Advanced Catagory Excluder, Akismet, All in one SEO, Contact Form 7, MailChimp widget, Sharedaddy, and Tweetable

Viewing 1 replies (of 1 total)
  • The call to query_posts needs to include the ‘paged’ argument.

    Give this a try:

    <?php
    if (!($paged = get_query_var('paged'))) {
       if (!($paged = get_query_var('page'))) {
          $paged = 1;
       }
    }
    query_posts("posts_per_page=3&paged=$paged");
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Pagination Problem’ is closed to new replies.