Ok,
Currently I have a function which adds a submenu to the Appearance admin section called Opening Times.
What I'd really like to have though is another section like Appearance but called Theme Settings, then I can add Opening Times, Description etc to it and create a whole sub section for that particular template. I've looked at the codex but I can't get my head around it as it's more geared towards plugins - can anyone help add to the code to try and accomplish this task?
<?php class ControlPanel {
var $default_settings = Array(
'day1' => 'Monday',
'time1' => '9:30-6:30'
);
function ControlPanel() {
add_action('admin_menu', array(&$this, 'admin_menu'));
add_action('admin_head', array(&$this, 'admin_head'));
if (!is_array(get_option('parkway')))
add_option('parkway', $this->default_settings);
$this->options = get_option('parkway');
if (function_exists('register_sidebar'))
register_sidebar(array('name' => 'Sidebar'));
}
function admin_menu() {
add_theme_page('Parkway Options', 'Opening Times', 'edit_themes', "parkway", array(&$this, 'optionsmenu'));
}
function admin_head() {
echo '<link rel="stylesheet" href="'.get_bloginfo('template_url').'/code/controlpanel.css" type="text/css" media="screen" />';
}
function optionsmenu() {
echo '<div id="icon-tools" class="icon32"><br /></div>';
echo '<div class="wrap">';
echo '<h2>Parkway Options</h2><br />';
echo '<h3>Opening Times</h3><hr color="lightgray" width="99%" align="left" size="1">';
if ($_POST['ss_action'] == 'save') {
$this->options["day1"] = $_POST['cp_day1'];
$this->options["time1"] = $_POST['cp_time1'];
update_option('parkway', $this->options);
echo '<div class="updated fade" id="message" style="background-color: rgb(255, 251, 204); width: 300px; margin-left: 20px"><p>Settings <strong>saved</strong>.</p></div>';
}
echo '<form action="" method="post" class="themeform">';
echo '<input type="hidden" id="ss_action" name="ss_action" value="save">';
echo '<p>Day of the Week: <input class="widefat" style="text-align: right; width: 75px" name="cp_day1" id="cp_day1" type="text" value="'.$this->options["day1"].'" /></p>';
echo '<p>Time: <input class="widefat" style="text-align: right; width: 75px" name="cp_time1" id="time1" type="text" value="'.$this->options["time1"].'" /></p>';
echo '<p class="submit"><input type="submit" value="Save Changes" name="cp_save"/></p>';
echo '</form>';
echo '</div>';
}
}
Thanks a lot for your time.
Steve