我需要在wordpress中返回一个帖子日期数组。基本上,如果我在wordpress中有10篇文章,我需要创建一个数组来返回这10篇文章每一篇的创建日期。我不需要这个列表排序,也不需要包含任何其他内容。很简单,对吧?
像这样:
$myarray = array();
query_posts();
// The Loop
while ( have_posts() ) : the_post();
$my_array = the_time('j');
endwhile;
我尝试了许多不同的方法来完成这一点,但他们都或多或少失败了。什么好主意吗?
您使用的the_time
不返回任何内容,直接显示输出
使用get_the_time()
while ( have_posts() ) : the_post();
$my_array[] = get_the_time('j');
endwhile;