I working on a theme options page for my template and want to integrate a checkbox. The problem is, the checkbox won't save the value. Where is my mistake? Well, I'm clueless...
<?php
add_action( 'admin_init', 'theme_options_init' );
add_action( 'admin_menu', 'theme_options_add_page' );
function theme_options_init(){
register_setting( 'wordpress_options', 'wordpress_theme_options');
}
function theme_options_add_page() {
add_theme_page('Options', 'Options', 'edit_theme_options', 'theme-options', 'wordpress_theme_options_page' );
}
function wordpress_theme_options_page() {
global $select_options, $radio_options;
if ( ! isset( $_REQUEST['settings-updated'] ) )
$_REQUEST['settings-updated'] = false; ?>
[...]
<?php if ( false !== $_REQUEST['settings-updated'] ) : ?>
<div class="updated fade">
<p><strong>Settings saved!</strong></p>
</div>
<?php endif; ?>
<form method="post" action="options.php">
<?php settings_fields( 'wordpress_options' ); ?>
<?php $options = get_option( 'wordpress_theme_options' ); ?>
<div id="admininterface">
[...]
<p>
<p class="before-form">Show RSS Icon:</p>
<?php $options = get_option( 'icon-rss-show' ); ?>
<input type="checkbox" name="$options[icon-rss-show]" value="1"<?php checked( 1 == $options['icon-rss-show'] ); ?> />
</p>
[...]
</div><!-- #admininterface -->
</form>
</div>
<?php } ?>