如何在 Wordpress 的循环外显示和创建带有最新帖子的框?我在这个链接的图片上展示了这个http://i.imgur.com/UbBvlnE.png .我在红框中谈论这个 ;) 对不起我的英语。
我在主页上的所有帖子都使用 Masonry CSS http://sickdesigner.com/masonry-css-getting-awesome-with-css3/
这是循环的代码:
<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>
最佳答案
$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'];
关于html - 如何在 Wordpress 循环外显示最新帖子?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18283298/