如何在Wordpress中显示循环外的最新帖子?

时间:2013-08-16 22:59:33

标签: html css wordpress loops post

如何在Wordpress中循环外显示和创建最新帖子的方框?我在此链接http://i.imgur.com/UbBvlnE.png的图片上显示了这一点。我在红框中谈论这个;) 抱歉我的英文。

我在主页http://sickdesigner.com/masonry-css-getting-awesome-with-css3/

上的所有帖子都使用了Masonry CSS

这是循环的代码:

<div class="all_center">
<?php query_posts($query_string."&orderby=post_date"); ?>
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                <div <?php post_class() ?> id="post-<?php the_ID(); ?>">

                        <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>


<?php the_post_thumbnail('mediumImageCropped'); ?>
                        <div class="entry">
                        <?php the_excerpt(); ?>
<div class="postmetadata">


                        </div>
</div>
</div>


        <?php endwhile; ?>



        <?php else : ?>

                <h2>Not Found</h2>

        <?php endif; ?>

</div>

1 个答案:

答案 0 :(得分:0)

$recent_posts = wp_get_recent_posts( array( 'numberposts' => '1' ) );

echo get_the_post_thumbnail($recent_posts[0]['ID'], 'thumbnail'); 

echo $recent_posts[0]['post_content'];