Problem with paginated query on single.php in WordPress


I wrote this question in the EasyEngine forum, before I realized there was a Nginx/WordPress-specific forum, so if an admin want, you can delete the original question!


Hi!

I have developed a WordPress site locally on apache, but online it’s running on Nginx.

Locally everything works as it should, but I have one slight problem online:

On my single.php posts, I’m querying the main loop under the post, and paginate the result (12 posts per page). This works as a charm on my local apache configuration, but online I’m running into the following problem:

It fetches the 12 first posts, but on page 2 it shows the first 12 posts once again, instead of 13-24. This goes on for every page, it only shows posts 1-12.

I’m wondering if this could be a rewrite issue or something?

This is the code I’m using below the single post to fetch the main loop:

<?php   
        $page = (get_query_var('paged')) ? get_query_var('paged') : 1;  
        query_posts("paged=$page");  
        if (have_posts()) : while (have_posts()) : the_post(); ?>  
		  
<?php  
endwhile;  
include (TEMPLATEPATH . '/inc/nav.php' );  
endif;  
?>

Any ideas what could be the problem?

You can see the site in question here: Delbart.se.

Thanks!

// Jens.

Ok, here’s some additional info which really makes me confused!

When working on a post that is not yet published (a draft), the query works as intended when I preview the post. Then, when I publish the post, the problem is back again.

It doesn’t matter if I’m logged in or not, published posts breaks the query, unpublished posts work.

Isn’t this weird?!