您好,我正在使用get_posts來抓取標記爲'news'的所有帖子並將它們顯示在給定頁面上。我使用the_date()來獲取日期,但奇怪的是,第一篇文章顯示沒有日期,而在此之後的所有文章顯示日期罰款。此外,我使用這個相同的代碼來顯示在另一個頁面上標記爲'blogs'的帖子,但它們工作正常。使用get_posts顯示wordpress帖子 - 第一篇文章顯示沒有日期
這裏是頁: http://appshare.nsdesign7.net/news/
另外這裏的其他頁面相同的代碼上使用,但工作得很好: http://appshare.nsdesign7.net/blog/
<? $pageTitle = wp_title('',false,'');
if ($pageTitle == " News") { ?>
<?php $appsharenewspage = array('numberposts' => 10, 'order'=> 'ASC', 'orderby'=> 'title', 'category' => 3);
$postslist = get_posts($appsharenewspage); foreach ($postslist as $post) : setup_postdata($post); ?>
<article class="newsstyle">
<span class="imagestyle"><?php the_post_thumbnail(array(120,120)); ?> </span>
<h3><?php the_title(); ?></h3>
<span class="date"><?php the_date(); ?></span>
<?php the_excerpt(); ?>
<div class="clear"></div>
</article>
<?php endforeach; ?>
<?php } ?>