Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a "featured" area in header.php that displays the content of the latest sticky post:

$last_sticky_post = get_post(end(get_option('sticky_posts')));
if(!empty($last_sticky_post)):
setup_postdata($last_sticky_post);
the_content();
endif;

problem is that the same post now renders below it in the Loop - how can I suppress sticky posts from appearing at all in the loop?

share|improve this question
add comment

1 Answer

Before your loop do:

$args = array(
    'ignore_sticky_posts' => 1
);
$query = new WP_Query( $args );
// The Loop
while ( $query->have_posts() ) : $query->the_post();
    echo '<li>';
    the_title();
    echo '</li>';
endwhile;
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.