"Options", "type" => "title"), array( "type" => "open"), array( "name" => "幻灯开关", "desc" => "控制首页幻灯片是否显示. 默认关闭.", "id" => $shortname."_slider", "std" => "", "type" => "select", "options" => array("Off", "On")), array( "name" => "外链图片略缩图开关", "desc" => "如果你的文章中使用外链图片,又希望显示这些外链图片的略缩图,则打开此项. 默认关闭.", "id" => $shortname."_external", "std" => "", "type" => "select", "options" => array("Off", "On")), array( "name" => "评论表情图片开关", "desc" => "控制评论表情图片是否显示. 默认关闭.", "id" => $shortname."_smiley", "std" => "", "type" => "select", "options" => array("Off", "On")), array( "type" => "close") ); 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=theme-options.php&saved=true"); die; } else if( 'reset' == $_REQUEST['action'] ) { foreach ($options as $value) { delete_option( $value['id'] ); } header("Location: themes.php?page=theme-options.php&reset=true"); die; } } add_theme_page($themename." Options", "$themename Options", 'edit_themes', basename(__FILE__), 'mytheme_admin'); } //add_theme_page($themename . 'Header Options', 'Header Options', 'edit_themes', basename(__FILE__), 'headimage_admin'); function headimage_admin(){ } function mytheme_admin() { global $themename, $shortname, $options; if ( $_REQUEST['saved'] ) echo '
'.$themename.' settings saved.
'.$themename.' settings reset.
| " /> | |
| /> | |