parent ) ) { add_menu_page( $this->page_title, $this->menu_title, $this->capability, $this->menu_slug, [ $this, 'display' ], 'dashicons-welcome-add-page', 2 ); } else { add_submenu_page( $this->parent, $this->page_title, $this->menu_title, $this->capability, $this->menu_slug, [ $this, 'display' ] ); } } public function display(): void { // Override in child classes. } }