From 7cd9693dcc1913535842fe6403f5adb62f94560e Mon Sep 17 00:00:00 2001 From: Torben Lundsgaard Date: Mon, 18 Sep 2023 14:43:03 +0200 Subject: [PATCH] Add option to specify the menu item position --- src/Admin/AbstractOptionsPage.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Admin/AbstractOptionsPage.php b/src/Admin/AbstractOptionsPage.php index 5868b0f..ca14099 100644 --- a/src/Admin/AbstractOptionsPage.php +++ b/src/Admin/AbstractOptionsPage.php @@ -73,7 +73,8 @@ public function add_admin_page(): void { $this->get_menu_title(), $this->get_capability(), $this->get_menu_slug(), - [ $this, 'render' ] + [ $this, 'render' ], + $this->get_position() ); } @@ -134,6 +135,15 @@ abstract protected function get_parent_slug(): string; */ abstract protected function get_tabs(): void; + /** + * The position in the menu order this item should appear. + * + * @return int|null + */ + protected function get_position(): ?int { + return null; + } + /** * Enqueue admin area scripts and styles. *