im using this WordPress Metabox framework: http://www.deluxeblogtips.com/p/meta-box-script-for-wordpress.html
here is the code
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'
),
),
how do i call the value of each of the radio values in the template?
i tried doing this but it only checks if it is set or not:
$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";
}
I like to use a short helper function for grabbing meta values.
When using this anytime you want to echo the value of a meta key you can use:
If you want to return the value:
Also in your answer you don’t need to use the
get_the_ID()function just use$post->ID