WordPress.org

Ready to get started?Download WordPress

Forums

Make sticky posts behave as normal using caller_get_posts=1 isn't working (1 post)

  1. LJK
    Member
    Posted 4 years ago #

    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; ?>
    			</ul>

    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

Topic Closed

This topic has been closed to new replies.

About this Topic