0
我無法在wordpress中顯示每篇文章的日期。對於每個帖子,它顯示的似乎是安裝日期,而不是發佈日期(每個帖子在不同日期發佈,但現在都顯示相似的隨機日期)。嘗試把get_the_date();在沒有運氣的情況下爲每一個lopp。有誰知道爲什麼?get_the_date();顯示wordpress安裝的日期,而不是發佈
$postsnumber = $nm_theme_options['numberposts'];
$args = array('numberposts' => "$postsnumber");
$recent_posts = wp_get_recent_posts($args);
$date = get_the_date();
foreach($recent_posts as $recent){
echo '<li><a href="' . get_permalink($recent["ID"]) . '">' . $date .' '. $recent["post_title"].'</a> </li> ';
}
難道你不想獲取每篇文章的日期,這意味着你需要在循環*中調用它*? – 2015-02-06 09:47:16
如果把它放在循環中並沒有什麼區別,但是,我會把它保留在那裏。 – DeSoto 2015-02-06 09:57:51
那麼請說明*你怎麼把它放在那裏 - 特別是,你是否使用帖子ID作爲參數? – 2015-02-06 09:59:33