【发布时间】:2009-10-14 14:13:22
【问题描述】:
我正在尝试在“循环”中构建一个数组,该数组由the_title()、the_excerpt()、the_permalink() 等各种函数提供的值组成。我想做一些类似于下面的事情。不幸的是,这些函数中的大多数会立即打印它们的结果而不是返回它们。此外,我已经检查了这些参数的可用参数,但没有找到任何强制返回的选项。
if (have_posts()) {
while (have_posts()) {
the_post();
$items[] = array(
"id" => get_the_id(), "the_title" => the_title(),
"the_excerpt" => the_excerpt(), "the_permalink" => the_permalink()
);
}
}
【问题讨论】: