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.

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>

        <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 " [...]"; ?>
            </a>
            </div>

            <!--<date>-->
            <div class="blog_date">

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

            </div>
            <!--</date>-->

        </div>


    </div>
<?php endwhile; ?>
</div>
share|improve this question

1 Answer 1

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

 
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.