'H5h95s0OuEg', "gravatar"=>"enabled", "gravatar_fallback"=>"identicon", ); # Settings $themename = "SlickPress Theme"; $shortname = "slickpress"; $options = array ( array( "name" => "Main Settings", "type" => "header" ), array( "name" => "Youtube Video ID", "id" => $shortname."_youtube", "std" => $settings['youtube'], "type" => "text", "note" => "Example: http://www.youtube.com/watch?v=H5h95s0OuEg"), array( "name" => "Gravatars", "id" => $shortname."_gravatar", "std" => $settings['gravatar'], "type" => "select", "options" => array(0=>'enabled', 1=>'disabled')), array( "name" => "Gravatar Fallback", "id" => $shortname."_gravatar_fallback", "std" => $settings['gravatar_fallback'], "type" => "text", "note" => "Example: monsterid, identicon, etc."), ); function mytheme_add_admin() { global $themename, $shortname, $options; if ( $_GET['page'] == basename(__FILE__) ) { if ( 'save' == $_REQUEST['action'] ) { foreach ($options as $value) { if ($value['type']!='header') { 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=settings.php&saved=true"); die; } else if( 'reset' == $_REQUEST['action'] ) { foreach ($options as $value) { delete_option( $value['id'] ); } header("Location: themes.php?page=settings.php&reset=true"); die; } } add_theme_page($themename." Settings", "Theme Settings", 'edit_themes', basename(__FILE__), 'mytheme_admin'); } function mytheme_admin() { global $themename, $shortname, $options; if ( $_REQUEST['saved'] ) echo '

'.$themename.' settings saved.

'; if ( $_REQUEST['reset'] ) echo '

'.$themename.' settings reset.

'; ?>

Settings

: " />    
:    
   

$v) { $var = $shortname.'_'.$k; if (!empty($$var)) $settings[$k] = $$var; } ?>