'Featured', 'youtube' => 'H5h95s0OuEg' ); # Settings $themename = "LeanMagazine Theme"; $shortname = "leanmagazine"; $options = array ( array( "name" => "Main Settings", "type" => "header" ), array( "name" => "Featured Category", "id" => $shortname."_featured", "std" => $settings['featured'], "type" => "text", "note" => "Category Name"), array( "name" => "Youtube Video ID", "id" => $shortname."_youtube", "std" => $settings['youtube'], "type" => "text", "note" => "Example: http://www.youtube.com/watch?v=H5h95s0OuEg") ); 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; } ?>