I am having trouble with multiple loops and sticky posts in wordpress.
The first loop I just want all the sticky posts.
<?php query_posts(array('post__in'=>get_option('sticky_posts'), 'cat' => '-15,-17, -5, -2')) ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php $do_not_duplicate = $post->ID; ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php endwhile; endif; ?>
In the second loop I want to get the all of the posts that are NOT sticky (so the sticky posts don't show). Currently all but the latest sticky post still show in the loop below.
Also the posts_per_page is including the posts in the first loop which I do not want. No matter how many sticky posts I add I want the number of posts that are NOT sticky to be consistent.
<?php query_posts($query_string . '&cat=-15,-17, -5, -2&post_type=post&posts_per_page=9'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
<?php the_first_category(); ?>
<a" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php the_excerpt(); ?>
<?php endwhile; ?>
<?php next_posts_link('Older →') ?>
<?php endif; ?>
Can anyone help or point me in the right direction?
ignore_stickies=1
in the second loop, or if using wp 3.0, then usecaller_get_posts=1
instead(same thing, just different name in 3.1).