【发布时间】:2015-07-16 08:20:06
【问题描述】:
我的博客中有一个股票代码 JavaScript 代码,我想在其中显示帖子链接。 我写了下面的代码,但 the_permalink() 和 the_title() 回显了 url 和标题,我的数组填充了空值?
$my_query = new WP_Query('showposts=10&offset=0&category_name=allposts');
$i = 0; $post_uris = array(); $post_titles = array();
while ($my_query->have_posts()) : $my_query->the_post();
$post_uris[$i]= '<a href="'.the_permalink().'">'. the_title().'</a>';
$i++;
endwhile;
【问题讨论】:
-
感谢您的回复,我知道了
-
get_posts() 是关键
标签: php wordpress post permalinks