On my last try I used the excact same code as in the book:
<?php
// Set some theme specific variables for the options panel
$childthemename = “Wicked Theme”;
$childshortname = “wt”;
$childoptions = array();
function childtheme_options() {
global $childthemename, $childshortname, $childoptions;
// Create array to store the Categories to be used in the drop-down select box
$categories_obj = get_categories(‘hide_empty=0’);
$categories = array();
foreach ($categories_obj as $cat) {
$categories[$cat->cat_ID] = $cat->cat_name;
}
$childoptions = array (
array( "name" => __('Link Color','thematic'),
"desc" => __('Change the color of links by entering a HEX color number. (e.g.: 003333)','thematic'),
"id" => "wicked_link_color",
"std" => "999999",
"type" => "text"
),
array( "name" => __('Show Header Image','thematic'),
"desc" => __('Show an image in the header. Replace the header.png file found in the /wicked/images/ folder with your own image, up to 120x100px.','thematic'),
"id" => "wicked_show_logo",
"std" => "false",
"type" => "checkbox"
),
array( "name" => __('Featured Category','thematic'),
"desc" => __('A category of posts to be featured on the front page.','thematic'),
"id" => "wicked_feature_cat",
"std" => $default_cat,
"type" => "select",
"options" => $categories
)
);
}
add_action(‘init’, ‘childtheme_options’);
// Make a Theme Options Page
function childtheme_add_admin() {
global $childthemename, $childshortname, $childoptions;
if ( $_GET[‘page’] == basename(FILE) ) {
if ( 'save' == $_REQUEST['action'] ) {
// protect against request forgery
check_admin_referer('childtheme-save');
// save the options
foreach ($childoptions as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) {
update_option( $value['id'], $_REQUEST[ $value['id'] ] );
} else {
delete_option( $value['id'] );
}
}
// return to the options page
header("Location: themes.php?page=options.php&saved=true");
die;
} else if ( 'reset' == $_REQUEST['action'] ) {
// protect against request forgery
check_admin_referer('childtheme-reset');
// delete the options
foreach ($childoptions as $value) {
delete_option( $value['id'] );
}
// return to the options page
header("Location: themes.php?page=options.php&reset=true");
die;
}
}
add_theme_page($childthemename." Options", “$childthemename Options”, ‘edit_themes’, basename(FILE), ‘childtheme_admin’);
}
add_action(‘admin_menu’ , ‘childtheme_add_admin’)
?>