"Hello.
Isn't this fun!",
"type" => "misc"),
array(
"name" => "Select Your Colours",
"type" => "title"),
array(
"type" => "open"),
array(
"name" => "The Background (colour)",
"desc" => "Here you can choose the background colour for the whole site. Awesome, no? In other news, you'll need to put the colour in #000000 format, except without the # bit.",
"id" => $shortname."_main_bg",
"std" => "000000",
"type" => "text",
"image" => "apic.jpg"),
array(
"name" => "Another Colour",
"desc" => "This is another colour used somewhere else in the theme. Again, #000000 just without the # bit.",
"id" => $shortname."_another_bg",
"std" => "ffffff",
"type" => "text",
"image" => "to-color-secondary.gif"),
array(
"type" => "close"),
array(
"type" => "submit"),
array(
"name" => "Show and get rid of stuff",
"type" => "title"),
array(
"type" => "open"),
array(
"name" => "Display the Search Box?",
"desc" => "Tick or untick the box to show or disable the search box",
"id" => $shortname."_sidebar_search",
"type" => "checkbox",
"image" => "to-sidebar-search.gif",
"std" => "true"),
array(
"type" => "close"),
array(
"type" => "submit"),
array(
"name" => "Some text you can customise",
"type" => "title"),
array(
"type" => "open"),
array(
"name" => "What is Your Name?",
"desc" => "Names are an integral part of our society. What's yours?",
"id" => $shortname."_your_name",
"type" => "text",
"image" => "",
"std" => "Frederick"),
array(
"type" => "close")
);
/*Add a Theme Options Page*/
function mytheme_add_admin() {
global $themename, $shortname, $options;
if ( $_GET['page'] == basename(__FILE__) ) {
if ( 'save' == $_REQUEST['action'] ) {
foreach ($options as $value) {
update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
foreach ($options as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } }
header("Location: themes.php?page=functions.php&saved=true");
die;
} else if( 'reset' == $_REQUEST['action'] ) {
foreach ($options as $value) {
delete_option( $value['id'] ); }
header("Location: themes.php?page=functions.php&reset=true");
die;
}
}
add_theme_page($themename." Options", "".$themename." Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
function mytheme_admin() {
global $themename, $shortname, $options;
if ( $_REQUEST['saved'] ) echo '
'.$themename.' settings saved.
'.$themename.' settings reset.