views:

348

answers:

1

I'm making a specific single.php template. It's using a jQuery slider to slide from one post to the next. In order to show the right post first, I have to use 2 loops - one to call the first single post, and then another loop to call all the other posts in the category.

This I do like this (might be a bit mucky, I'm no PHP guru)

<ul id="tour-items">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<li>
 <h2><?php the_title(); ?></h2>
 <?php the_content(); ?>
</li>
<?php endwhile; endif; ?>
<?php $briefingsposts = new WP_Query(array(
 'caller_get_posts' => 1,
 'category_name' => Briefings,
 'offset' => 1
 )); ?>
<?php while ($briefingsposts->have_posts()) : $briefingsposts->the_post(); ?>
<li>
 <h2><?php the_title(); ?></h2>
 <?php the_content(); ?>
</li>
<?php endwhile; ?>

However, if the first post is a sticky post, it's repeating in the category loop despite the 'offset' => 1 which I assume is because it's doing it's sticky behaviour and sticking itself to the top.

I've tried using 'caller_get_posts' => 1 in the array but it doesn't seem to make any difference at all. I dont want to exclude sticky posts, just make them behave as normal. Is there a way that might work within my queries?

Thanks,

Laura

A: 

This:

$briefingsposts = new WP_Query(array(
 'caller_get_posts' => 1,
 'category_name' => Briefings,
 'offset' => 1,
 'post__not_in'=>get_option('sticky_posts')
 ));

Should do the trick.

Zahymaka
This does work, but I don't want to exclude the sticky posts, I want to make them behave as normal non-sticky posts.
Laura Kalbag
Hmmm. According to the docs caller_get_posts should display sticky posts as normal so your original query <em>ought</em> to work, but apparently it doesn't.Have you checked the date on your sticky post?
Zahymaka