即時通訊使用這個WordPress Metabox框架:http://www.deluxeblogtips.com/p/meta-box-script-for-wordpress.htmlWordpress metabox:如何獲得具有多個值的字段值?
這裏是代碼
array(
'name' => '<strong>Robots Meta</strong>',
'desc' => '',
'id' => $prefix . 'robot',
'type' => 'radio',
'options' => array(
'if' => 'index, follow',
'in' => 'index, nofollow',
'nf' => 'noindex, follow',
'nn' => 'noindex, nofollow'
),
),
我如何調用每個模板的無線電值的價值?
我想這樣做,但它只是檢查是否設置與否:
$metas = get_post_meta(get_the_ID(), 'hiro_robot', false);
foreach ($metas as $meta) {
echo $meta;
}
if (in_array($val, $metas)) {
echo "$val is set";
} else {
echo "$val is not set";
}