【发布时间】:2012-03-10 18:54:00
【问题描述】:
我使用 wordpress 作为我的基础,我需要为我的所有帖子输出帖子元数据,但仅限于一定数量的键。
我打算做的是保存我所有键的列表,我将使用它来查询 wordpress 以获取该帖子的元数据。
下面是我的代码。
//HERE YOU CAN SEE THE KEYS IMM USING ATM
$nyckellista[] = array("ebutik_allm_bas_operativsystem" ,"--foretagsform"
,"ebutik_allm_bas_omsättning");
$i = 0;
//Here im trying to query the get_post_meta with my keys and save the result (it's an array aof values that it return)
foreach($nyckellista as $nyckel)
{
$nyckellista[$i] = get_post_meta($post->ID,$nyckel,false);
echo $i . "Nyckel:" . $nyckel[$i];
$i++;
}
//HERE ME TRYING TO PRINT THE ARRAY CONTENTS
$count = count ($nyckellista);
echo $count;
for($y=1; $y <= $count; $y++)
{
$countmore=count($nyckellista[$y]);
for($x=1; $x <= $countmore; $x++)
{
print ($nyckellista[$y][$x] . "<br> ");
}
echo "<br>";
}
我做错了什么?
【问题讨论】: