/* ---------------------------------------------------------- دسته بندی ها ------------------------------------------------------------- */ $themename = "مدرسه وردپرس"; $shortname = "shortname"; $categories = get_categories('hide_empty=0&orderby=name'); $all_cats = array(); foreach ($categories as $category_item ) { $all_cats[$category_item->cat_ID] = $category_item->cat_name; } array_unshift($all_cats, "انتخاب دسته بندی"); /*--------------------------------------------------- ساخت تنظیمات ----------------------------------------------------*/ function theme_settings_init(){ register_setting( 'theme_settings', 'theme_settings' ); wp_enqueue_style("panel_style", get_template_directory_uri()."/panel.css", false, "1.0", "all"); wp_enqueue_script("panel_script", get_template_directory_uri()."/panel_script.js", false, "1.0"); } /*--------------------------------------------------- افزودن تنظیمات به منو پیشخوان ----------------------------------------------------*/ function add_settings_page() { add_menu_page( __( 'تنظیمات' . 'wpschool' ), __( 'تنظیمات' . 'wpschool' ), 'manage_options', 'settings', 'theme_settings_page'); } add_action( 'admin_init', 'theme_settings_init' ); add_action( 'admin_menu', 'add_settings_page' ); /* --------------------------------------------------------- تعریف آرایه های تنظیمات ----------------------------------------------------------- */ $theme_options = array ( array( "name" =>" تنظیمات" . $themename, "type" => "title"), /* --------------------------------------------------------- بخش تنظیمات عمومی ----------------------------------------------------------- */ array( "name" => "عمومی", "type" => "section"), array( "type" => "open"), array( "name" => "لوگو سایت", "desc" => "عکس لوگو را وارد کنید", "id" => "logo", "type" => "text", "std" => ""), array( "name" => "آیکن سایت", "desc" => "آیکن سایت باید در اندازه 16*16 باشد ", "id" => $shortname."_favicon", "type" => "text", "std" => get_bloginfo('url') ."/images/favicon.ico"), array( "type" => "close"), /* --------------------------------------------------------- بخش تنظیمات صفحه نخست ----------------------------------------------------------- */ array( "name" => "صفحه نخست", "type" => "section"), array( "type" => "open"), array( "name" => "مطالب ویژه صفحه نخست", "desc" => "دسته مطالب ویژه را انتخاب کنید", "id" => $shortname."_feat_cat", "type" => "select", "options" => $all_cats, "std" => "انتخاب دسته"), array( "type" => "close"), /* --------------------------------------------------------- بخش تنظیمات فوتر ----------------------------------------------------------- */ array( "name" => "فوتر", "type" => "section"), array( "type" => "open"), array( "name" => "متن کپی رایت فوتر", "desc" => "متن کپی رایت را وارد کنید", "id" => "footer_text", "type" => "textarea", "std" => ""), array( "type" => "close") ); /*--------------------------------------------------- تعریف بخش های پنل ----------------------------------------------------*/ function theme_settings_page() { global $themename,$theme_options; $i=0; $message=''; if ( 'save' == $_REQUEST['action'] ) { foreach ($theme_options as $value) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } foreach ($theme_options as $value) { if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } } $message='saved'; } else if( 'reset' == $_REQUEST['action'] ) { foreach ($theme_options as $value) { delete_option( $value['id'] ); } $message='reset'; } ?>

تنظیمات قالب '.$themename.' ذخیره شد.

'; if ( $message=='reset' ) echo '

'.$themename.' settings reset.

'; ?>

از این پنل برای تنظیم سایت استفاده کنید

" />
/>