快速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