From 43409893b3d09627854edd953f72fab42043305c Mon Sep 17 00:00:00 2001 From: Antoine M Date: Tue, 10 Dec 2024 12:14:25 +0100 Subject: [PATCH] refining admin menu orders and displays --- includes/admin.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/includes/admin.php b/includes/admin.php index ab937d6..bb0d172 100644 --- a/includes/admin.php +++ b/includes/admin.php @@ -1,4 +1,15 @@ 3, + 'edit.php?post_type=artisans' => 4, + 'edit.php?post_type=page' => 5, + 'upload.php' => 7, + 'theme-general-settings' => 11, + 'rank-math' => 20, + ); + // helper function to move an element inside an array + function metiers_move_element(&$array, $a, $b) + { + $out = array_splice($array, $a, 1); + array_splice($array, $b, 0, $out); + } + // traverse through the new positions and move + // the items if found in the original menu_positions + foreach ($new_positions as $value => $new_index) { + // write_log($value); + if ($current_index = array_search($value, $menu_order)) { + metiers_move_element($menu_order, $current_index, $new_index); + } + } + return $menu_order; +}; +add_action('admin_menu', function () { + add_filter('menu_order', 'metiers_new_admin_menu_order'); + add_filter('custom_menu_order', '__return_true'); +});