WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im sorry about my english.

I using below code to display recent post in my footer. The problem is, my recent post show sticky post. How to hide or remove sticky post from recent post??

<div class="footer_rct">

<?php $recent = new WP_Query("showposts=5"); while($recent->have_posts()) : $recent->the_post();?>
    <div class="footer_recent_item">

        <div class="footer_rct_images">
        <?php if (has_post_thumbnail()) { ?>
        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('img100'); ?></a>
        <?php } else { ?>
        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/nophoto.png" /></a>
        <?php } ?>

        <div class="footer_rct_tit_img">

            <div class="footer_rct_tit">
            <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
            <?php $tit = the_title('','',FALSE); echo substr($tit, 0, 46); if (strlen($tit) > 46) echo " [...]"; ?>

            <div class="blog_date">

            <div class="blog_date_3">
            <?php the_time('M jS, Y') ?>



<?php endwhile; ?>
share|improve this question
up vote 1 down vote accepted

You can try this:

$args = array( 
           'post__not_in' => get_option( 'sticky_posts' ), 
           'posts_per_page' => 5, 
$recent = new WP_Query( $args );

to exclude the sticky posts. You can read more about it here in the Codex.

share|improve this answer
Thank you so much Birgire. – v123shine May 27 '13 at 4:12
you're welcome, if that solved your problem, please mark the answer as accepted. See howto here. – birgire May 27 '13 at 9:01

Your Answer


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.