快速WordPress的问题。WordPress的最新帖子精选图像
我想显示我的类别“照片”中的最后30个帖子,但仅在相关页面上显示特色图片,作为将用户转到实际帖子的链接。
我设法做到了这一点,但它显示所有类别的帖子,而不是“照片”类别。我正在使用的代码如下。
我确定它很简单,但很想知道如何仅显示来自照片类别的最近帖子(作为特色图片)。
感谢
<!-- In functions.php -->
function recentPosts() {
\t $rPosts = new WP_Query();
\t $rPosts->query('showposts=100');
\t \t while ($rPosts->have_posts()) : $rPosts->the_post(); ?>
\t \t <div class="photos">
\t \t \t <li class="recent">
\t \t \t \t <a href="<?php the_permalink();?>"><?php the_post_thumbnail('recent-thumbnails'); ?></a>
\t \t \t </li> \t
\t \t </div>
\t \t <?php endwhile;
\t wp_reset_query();
}
<!-- this is on the page template -->
<?php echo recentPosts(); ?>
太好了,谢谢!这解决了它。 – Dan 2015-03-03 09:34:27