Theme Option Page – register_setting
-
I’m updating a option page for my theme to use settings_fields and post to options.php
The code works and the option is save to the wp_options table, but I do not get a confirmation message back.
Example: <div id=”message” class=”updated”>Setting Saved</div>Here is the code:
function swc_form_init () { register_setting('swc_form_options', 'swc_theme_color_selection', ); } add_action('admin_init','swc_form_init'); // theme color options function swc_theme_color_page() { ?> <div class="wrap"><?php screen_icon(); ?> <h2>Theme Color</h2> <form action="options.php" method="post" id="swc-theme-color-form"> <?php settings_fields('swc_form_options'); ?> <h3><label for="swc_theme_color_selection">Enter you color option</label> <input type="text" id="swc_theme_color_selection" name="swc_theme_color_selection" value="<?php echo esc_attr(get_option('swc_theme_color_selection')); ?>" /></h3> <p><input type="submit" name="submit" value="Save Selection" /></p> </form> </div>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Theme Option Page – register_setting’ is closed to new replies.