Hi everyone. I'm trying to develop a premium WP theme and I have a problem with the custom options page that I've added.
I have set the settings table and it works. When I save my custom options the frontend shows them correctly, the settings page shows the default values though, and not the changed values. Here's where the code goes through the options to pront them in the backend:
Can you help? I'm really frustrated with this. Thanks!Code:<?php foreach ($options as $value) { switch ( $value['type'] ) { case 'text': ?> <tr valign="top"> <th scope="row"><label for="<?php echo $value['id']; ?>"><?php echo __($value['name'],'thematic'); ?></label></th> <td> <input size="30" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_option( $value['id'] ) != "") { echo get_option( $value['id'] ); } else { echo $value['std']; } ?>" /> <?php echo __($value['desc'],'thematic'); ?> </td> </tr> <?php break; case 'textarea': $ta_options = $value['options']; ?> <tr valign="top"> <th scope="row"><label for="<?php echo $value[$shortname.'id']; ?>"><?php echo __($value['name'],'thematic'); ?></label></th> <td><textarea name="<?php echo $value['id']; ?>" id="<?php echo $value[ $shortname.'id']; ?>" cols="<?php echo $ta_options['cols']; ?>" rows="<?php echo $ta_options['rows']; ?>"><?php if( get_option($value['id']) != "") { echo __(stripslashes(get_option($value['id'])),'thematic'); }else{ echo __($value['std'],'thematic'); }?></textarea><br /><?php echo __($value['desc'],'thematic'); ?></td> </tr> <?php break; case 'nothing': $ta_options = $value['options']; ?> </table> <?php echo __($value['desc'],'thematic'); ?> <table class="form-table"> <?php break; case 'radio': ?> <tr valign="top"> <th scope="row"><?php echo __($value['name'],'thematic'); ?></th> <td> <?php foreach ($value['options'] as $key=>$option) { $radio_setting = get_option($value['id']); if($radio_setting != ''){ if ($key == get_option($value['id']) ) { $checked = "checked=\"checked\""; } else { $checked = ""; } }else{ if($key == $value['std']){ $checked = "checked=\"checked\""; }else{ $checked = ""; } }?> <input type="radio" name="<?php echo $value['id']; ?>" id="<?php echo $value['id'] . $key; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?> /><label for="<?php echo $value['id'] . $key; ?>"><?php echo $option; ?></label><br /> <?php } ?> </td> </tr> <?php break; case 'checkbox': ?> <tr valign="top"> <th scope="row"><?php echo __($value['name'],'thematic'); ?></th> <td> <?php if(get_option($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = ""; } ?> <input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> /> <label for="<?php echo $value['id']; ?>"><?php echo __($value['desc'],'thematic'); ?></label> </td> </tr> <?php break; default: break; case 'title': ?> <tr valign="top"> <th scope="row"><h3><?php echo __($value['name'],'thematic'); ?></h3></th></tr> <?php break; } } ?>


Reply With Quote

Bookmarks