I have a custom field name called as ‘key’ . Inside ‘key’, I have an array stored an array.
Here are the codes:
$meta_boxes = array(
"price" => array(
"name" => "price",
"title" => $options['pricetext'],
"description" => "Enter the price of the property (no commas or currency).",
"type" => "range",
"class" => "range",
"rows" => "",
"width" => "",
"hide_in_search" => $options['pricehide'],
"options" => ""
),
// other type
);
When I want to show these fields in the post:
$data = get_post_meta($post->ID, $key, true);
$output .= '<input type="text" name="' . $meta_box['name'] . '" value="' . (isset($data[$meta_box['name']]) ? $data[$meta_box['name']] : '') . '" style="margin-top:3px;width:' . $meta_box['width'] . ';" />';
echo $output;