I suspect that the problem is in the parameters to query_posts. You may be missing the ‘paged’ parameter. Since I can’t see your code, this may not be quite right, but I hope it will help:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("paged=$paged");
Of course, you need to keep any other parameters you already have.
Were you able to get this fix? I am having the same issue. sidebar(left) calls the query and single page(right) displays selecttion. however everytime I go to other post on the other pages the sidebar will go back to page1 even though the selected post is on page 2
Hmm, I thought that might be another place with an error by I think my code is correct. I’ve included a longer snippet of code below – including the paged parameter – if you see anything I’ve missed, that would be very helpful.
I’m a bit concerned that, while modifying the page to bits, I removed some </div> somewhere so they’re not matching up – could that be making a difference?
<div id="front-list">
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=-27,-28&paged=$paged&posts_per_page=5"); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="clearfloat">
<h3 class=cat_title><?php the_category(', '); ?> »</h3>
<div class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title();
?></a></div>
<div class="meta">[<?php the_time('j M Y') ?> | <?php comments_popup_link('No Comment', 'One
Comment', '% Comments');?>]</div>
<div class="spoiler">
<?php $values = get_post_custom_values("Image");
if (isset($values[0])) { ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title();
?>">
<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php
$values = get_post_custom_values("Image"); echo $values[0]; ?>&w=150&h=150&zc=1&q=100"
alt="<?php the_title(); ?>" class="left" width="150px" height="150px" /></a>
<?php } ?>
<?php the_excerpt(); ?>
</div>
</div>
<?php endwhile; ?>
<div class="navigation">
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
else { ?>
<div class="right"><?php next_posts_link('Next Page »') ?></div>
<div class="left"><?php previous_posts_link('« Previous Page') ?></div>
<?php } ?>
</div>
</div>
</div>
<?php get_footer(); ?>
is there another query_posts() before tho code that you posted?
is so, try and add a ‘wp_reset_query();’ in your posted code:
<div id="front-list">
<?php wp_reset_query(); ?>
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=-27,-28&paged=$paged&posts_per_page=5"); ?>
<?php while (have_posts()) : the_post(); ?>
AH brilliant! That’s solved the problem, thanks so much alchymyth!
Alchymyth you just became my personal god!