【发布时间】:2014-07-20 18:36:11
【问题描述】:
我有以下数组:
array (12,15,21,32,33);
然后我使用以下查询来获取帖子(上面的 ID):
$the_query = new WP_Query( array("post__in"=>$ids_array) ); // edited
while($the_query->have_posts())
{
$the_query->the_post(); // added on edit, but still does not work
the_title()."<br />";
}
但我什么也没得到,没有错误,也没有中断。我检查了 ID,它们是正确的。
编辑:我已将此查询放在加载到页脚中的模块的末尾。不知道重要不重要:
【问题讨论】:
-
如果 $ids_array 已经是一个数组,为什么要把它放到另一个数组中?你的代码不应该只是
$the_query = new WP_Query( array("post__in"=>$ids_array) );吗?