Support » Fixing WordPress » WP 3.0 bug with pagination? (when using static page as homepage)

  • Resolved mjepson

    (@mjepson)


    Hey,

    Our users have reported trouble with our custom page templates when using a static homepage. The page template has a query_posts with pagination in it. Here is an example for our standard blog page template:

    <?php
    /*
    Template Name: Blog
    */
    ?>
    <?php get_header(); ?>
    <?php global $woo_options; ?>
    
    	<?php woo_crumbs(); ?>
    	</div><!-- /#top -->
    
       <div id="content">
    	<div class="col-full">  
    
            <!-- #main Starts -->
            <div id="main" class="col-left">      
    
    		<?php
    		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		$args=array(
    		   'paged'=>$paged,
    		   );
    		query_posts($args);
    		 ?>
            <?php if (have_posts()) : $count = 0; ?>
            <?php while (have_posts()) : the_post(); $count++; ?>
    
                <!-- Post Starts -->
                <div <?php post_class(); ?>>
    
                    <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
                    <div class="entry">
    					<?php global $more; $more = 0; ?>
    					<?php the_content(); ?>
                    </div>
    
                </div><!-- /.post -->
    
            <?php endwhile; else: ?>
                <div class="post">
                    <p><?php _e('Sorry, no posts matched your criteria.', 'woothemes') ?></p>
                </div><!-- /.post -->
            <?php endif; ?>  
    
    	        <div class="post-entries">
    	            <div class="post-prev fl"><?php previous_post_link( '%link', '<span class="meta-nav">&laquo;</span> %title' ) ?></div>
    	            <div class="post-next fr"><?php next_post_link( '%link', '%title <span class="meta-nav">&raquo;</span>' ) ?></div>
    	            <div class="fix"></div>
    	        </div>	
    
            </div><!-- /#main -->
            <?php woo_main_after(); ?>
    
            <?php get_sidebar(); ?>
    
    	</div><!-- /#col-full -->
        </div><!-- /#content -->
    
    <?php get_footer(); ?>

    This worked fine in all our themes in WP 2.9.2, and works fine in WP 3.0 as a normal page:

    Blog page 1: http://cl.ly/6716a2a1fd3e314deac5
    Blog page 2: http://cl.ly/969377b06da3669e9b53

    If you set it up as static page homepage:

    http://cl.ly/ebffedf37b7a3c5d709b

    It shows only the page title of that page:

    http://cl.ly/8a3addadd9defe9dbce2

    Exactly the same page template as static homepage in WP 2.9.2:

    http://cl.ly/9eff8e3a1ec33a5b9f51

    I couldn’t see any changes on the codex page for query_posts, so I’m thinking this might be a bug?

    Copying the page template (template-blog.php) to home.php works fine as well.

    Another note, it doesn’t matter which static homepage you select… It can be a normal page, it doesn’t have to be the page template in question. The page template stops working when you set a static homepage.

Viewing 1 replies (of 1 total)
  • If I add cat=& to the query, the page shows, but pagination doesn’t work…

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=&paged=$paged"); ?>

    If I echo $paged on /?paged=2 it simply outputs 1

Viewing 1 replies (of 1 total)
  • The topic ‘WP 3.0 bug with pagination? (when using static page as homepage)’ is closed to new replies.