您好,我正在使用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 } ?>