I'm building a theme options panel and so far been successful, except with the "Select" type option. This is my code:
array( "name" => "Transition",
"desc" => "Choose the type of transition.",
"id" => $shortname."_transition",
"type" => "select",
"std" => '1',
"options" => array("0" => "None", "1" => "Fade", "2" => "Slide Top", "3" => "Slide Right"),
Now, my select code is this:
<select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
<?php foreach ($value['options'] as $option) { ?><option <?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?>
Now, when I pull the option into the theme, it outputs the option name (fade, Slide Top...etc) instead of the value (0, 1, 2, 3).
I'm guessing here that perhaps I'm missing the value=""
from the /option>
code? any help would be appreciated, thank you.
Edit: figured it out, edited the second code to this:
<?php foreach ($value['options'] as $key=>$option) { ?><option value="<?php echo $key; ?>" <?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?></select>