瀏覽代碼

Add: menu reorder

Mozahidur Rahman 1 年之前
父節點
當前提交
696a9d0d14
共有 3 個文件被更改,包括 61 次插入6 次删除
  1. 1 0
      inc/acf-settings.php
  2. 21 6
      inc/custom-post-type.php
  3. 39 0
      inc/theme-settings.php

+ 1 - 0
inc/acf-settings.php

@@ -66,6 +66,7 @@ if (function_exists('acf_add_options_page')) {
         'menu_title'    => 'UIU Theme: CSE',
         'menu_slug'     => 'uiu-cse-general-settings',
         'capability'    => 'edit_posts',
+        'position' => '10.5',
         'redirect'        => false
     ));
 

+ 21 - 6
inc/custom-post-type.php

@@ -47,7 +47,7 @@ function uiu_cpt_faculty()
         'public'                => true,
         'show_ui'               => true,
         'show_in_menu'          => true,
-        'menu_position'         => 5,
+        'menu_position'         => 11,
         'menu_icon'             => 'dashicons-businessperson',
         'show_in_admin_bar'     => true,
         'show_in_nav_menus'     => true,
@@ -110,7 +110,7 @@ function uiu_cpt_story()
         'public'                => true,
         'show_ui'               => true,
         'show_in_menu'          => true,
-        'menu_position'         => 5,
+        'menu_position'         => 12,
         'menu_icon'             => 'dashicons-businessperson',
         'show_in_admin_bar'     => true,
         'show_in_nav_menus'     => true,
@@ -174,7 +174,7 @@ function uiu_cpt_alumni()
         'public'                => true,
         'show_ui'               => true,
         'show_in_menu'          => true,
-        'menu_position'         => 5,
+        'menu_position'         => 13,
         'menu_icon'             => 'dashicons-businessperson',
         'show_in_admin_bar'     => true,
         'show_in_nav_menus'     => true,
@@ -234,7 +234,7 @@ function uiu_cpt_notice()
         'public'                => true,
         'show_ui'               => true,
         'show_in_menu'          => true,
-        'menu_position'         => 5,
+        'menu_position'         => 14,
         'menu_icon'             => 'dashicons-businessperson',
         'show_in_admin_bar'     => true,
         'show_in_nav_menus'     => true,
@@ -294,7 +294,7 @@ function uiu_cpt_event()
         'public'                => true,
         'show_ui'               => true,
         'show_in_menu'          => true,
-        'menu_position'         => 5,
+        'menu_position'         => 15,
         'menu_icon'             => 'dashicons-businessperson',
         'show_in_admin_bar'     => true,
         'show_in_nav_menus'     => true,
@@ -355,7 +355,7 @@ function uiu_cpt_news()
         'public'                => true,
         'show_ui'               => true,
         'show_in_menu'          => true,
-        'menu_position'         => 5,
+        'menu_position'         => 16,
         'menu_icon'             => 'dashicons-businessperson',
         'show_in_admin_bar'     => true,
         'show_in_nav_menus'     => true,
@@ -370,3 +370,18 @@ function uiu_cpt_news()
     register_post_type('news', $args);
 }
 add_action('init', 'uiu_cpt_news', 0);
+
+// $existing_CPT_menu = 'edit.php?post_type=notice';
+// $link_our_new_CPT = 'edit.php?post_type=news';
+
+// add_submenu_page($existing_CPT_menu, 'SubmenuTitle', 'SubmenuTitle', 'manage_options', $link_our_new_CPT);
+
+// // functions.php
+// add_action('admin_menu', function () {
+//     add_menu_page(
+//         'Custom Admin Page',
+//         'Custom Admin Page',
+//         'manage_options',
+//         'faculty',
+//     );
+// });

+ 39 - 0
inc/theme-settings.php

@@ -106,3 +106,42 @@ function prefix_disable_gutenberg($current_status, $post_type)
 	return $current_status;
 }
 add_filter('use_block_editor_for_post_type', 'prefix_disable_gutenberg', 10, 2);
+
+
+
+function gs_custom_menu_order($menu_ord)
+{
+	if (!$menu_ord) return true;
+	return array(
+		'index.php',
+		// 'separator1',
+		'edit.php?post_type=page',
+		'edit.php',
+		'upload.php',
+		'edit-comments.php',
+		'separator1',
+	);
+
+	/* -- DEFAULTS -- */
+
+	/*
+	return array(
+		'index.php',
+		'separator1',
+		'edit.php?post_type=page',
+		'edit.php',
+		'edit.php?post_type=[your_post_type_slug]',
+		'upload.php',
+		'link-manager.php',
+		'edit-comments.php',
+		'separator2',
+		'themes.php',
+		'plugins.php',
+		'users.php',
+		'tools.php',
+		'options-general.php'
+	);
+	*/
+}
+add_filter('custom_menu_order', 'gs_custom_menu_order');
+add_filter('menu_order', 'gs_custom_menu_order');