I apologize if this is covered extensively elsewhere, I'm not sure how to phrase my searches on the topic.
Basically, instead of the following standard code to store data in WP-options...
$options = array (
array("name" => __('Font','mytheme'),
"desc" => __('Change the font face)','mytheme'),
"id" => "mytheme_font",
"std" => "Arial",
"type" => "text"),
array("name" => __('Alternate Font','mytheme'),
"desc" => __('Change the alternate font face)','mytheme'),
"id" => "mytheme_font_alternate",
"std" => "Tahoma",
"type" => "text"),
);
I would instead like to store multiple values in the "std" portion, with its own array - like this:
$options = array (
array("name" => __('Font','mytheme'),
"desc" => __('Change the font face)','mytheme'),
"id" => "mytheme_font",
"std" => array('size' => '10px', 'face' => 'Arial', 'color' => '#000000'),
"type" => "text"),
array("name" => __('Alternate Font','mytheme'),
"desc" => __('Change the alternate font face)','mytheme'),
"id" => "mytheme_font_alternate",
"std" => array('size' => '13px', 'face' => 'Tahoma', 'color' => '#FF0000'),
"type" => "text"),
);
I would assume this is allowed, but given that it is, I am at a loss for how to:
1) Know which name/id to use on the admin form inputs to signify to go into "size" and "face" and "color".
For example, in the standard code without the multidimensional array I would usually use code like this:
<input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="text" value="<?php echo stripslashes(get_option( $value['id'], $value['std'] )); ?>" />
I'm not sure what to place in the "name" and "id" sections for the input.
2) How would I retrieve these values in the WP theme? I usually use code like this:
// Make values available
global $options;
foreach ($options as $value) {
$$value['id'] = get_option($value['id'], $value['std']);
}
// Print the actual value
<?php echo $mytheme_font; ?>;}
Any help is greatly appreciated! If anyone has any ideas or knows of any tutorials on this topic that would be excellent! Thank you!