"Orange", "text_area" => "Space to put a lot of information here!", "text_string" => "Some sample text", "pass_string" => "123456", "chkbox1" => "", "chkbox2" => "on", "option_set1" => "Triangle"); update_option('plugin_options', $arr); } } // Register our settings. Add the settings section, and settings fields function sampleoptions_init_fn(){ register_setting('plugin_options', 'plugin_options', 'plugin_options_validate' ); add_settings_section('main_section', 'Main Settings', 'section_text_fn', __FILE__); add_settings_field('plugin_text_string', 'Text Input', 'setting_string_fn', __FILE__, 'main_section'); add_settings_field('plugin_text_pass', 'Password Text Input', 'setting_pass_fn', __FILE__, 'main_section'); add_settings_field('plugin_textarea_string', 'Large Textbox!', 'setting_textarea_fn', __FILE__, 'main_section'); add_settings_field('plugin_chk2', 'A Checkbox', 'setting_chk2_fn', __FILE__, 'main_section'); add_settings_field('radio_buttons', 'Select Shape', 'setting_radio_fn', __FILE__, 'main_section'); add_settings_field('drop_down1', 'Select Color', 'setting_dropdown_fn', __FILE__, 'main_section'); add_settings_field('plugin_chk1', 'Restore Defaults Upon Reactivation?', 'setting_chk1_fn', __FILE__, 'main_section'); } // Add sub page to the Settings Menu function sampleoptions_add_page_fn() { add_options_page('Options Example Page', 'Options Example', 'administrator', __FILE__, 'options_page_fn'); } // ************************************************************************************************************ // Callback functions // Section HTML, displayed before the first option function section_text_fn() { echo '

Below are some examples of different option controls.

'; } // DROP-DOWN-BOX - Name: plugin_options[dropdown1] function setting_dropdown_fn() { $options = get_option('plugin_options'); $items = array("Red", "Green", "Blue", "Orange", "White", "Violet", "Yellow"); echo ""; } // TEXTAREA - Name: plugin_options[text_area] function setting_textarea_fn() { $options = get_option('plugin_options'); echo ""; } // TEXTBOX - Name: plugin_options[text_string] function setting_string_fn() { $options = get_option('plugin_options'); echo ""; } // PASSWORD-TEXTBOX - Name: plugin_options[pass_string] function setting_pass_fn() { $options = get_option('plugin_options'); echo ""; } // CHECKBOX - Name: plugin_options[chkbox1] function setting_chk1_fn() { $options = get_option('plugin_options'); if($options['chkbox1']) { $checked = ' checked="checked" '; } echo ""; } // CHECKBOX - Name: plugin_options[chkbox2] function setting_chk2_fn() { $options = get_option('plugin_options'); if($options['chkbox2']) { $checked = ' checked="checked" '; } echo ""; } // RADIO-BUTTON - Name: plugin_options[option_set1] function setting_radio_fn() { $options = get_option('plugin_options'); $items = array("Square", "Triangle", "Circle"); foreach($items as $item) { $checked = ($options['option_set1']==$item) ? ' checked="checked" ' : ''; echo "
"; } } // Display the admin options page function options_page_fn() { ?>

My Example Options Page

Some optional text here explaining the overall purpose of the options and what they relate to etc.