Administrator Menus
From Osclass Enterprise
Administrator Menus
Usualy plugin and themes needs to add menus in the Administrator panel for provide access to screens. The best way is adding a menu section in the Administration menu that allows the user to access the screens.
There are some functions for manipulate the Administration Menu.
hAdminMenu helper
Add menu page to Administration Menu.
osc_add_admin_menu_page( $menu_title, $url, $menu_id, $icon_url = null, $capability = null, $position = null )
Add submenu page to Administration Menu page given a menu parent identifier.
osc_add_admin_submenu_page( $menu_id, $submenu_title, $url, $submenu_id, $capability = null, $icon_url = null )
Remove menu page from Administrator Menu.
osc_remove_admin_menu_page($id_menu);
Remove submenu page given parent menu page identifier.
osc_remove_admin_submenu_page( $menu_id, $submenu_id )
Helpers can add submenus to existing menus, like:
[ Listings/Categories/Pages/Appearance/Plugins/Settings/Tools/Users/Statistics ]
osc_admin_menu_items( $submenu_title, $url, $submenu_id, $capability = null, $icon_url = null ) osc_admin_menu_categories( $submenu_title, $url, $submenu_id, $capability = null, $icon_url = null ) osc_admin_menu_pages( $submenu_title, $url, $submenu_id, $capability = null, $icon_url= null) osc_admin_menu_appearance( $submenu_title, $url, $submenu_id, $capability = null, $icon_url = null ) osc_admin_menu_plugins( $submenu_title, $url, $submenu_id, $capability = null, $icon_url = null ) osc_admin_menu_settings( $submenu_title, $url, $submenu_id, $capability = null, $icon_url = null ) osc_admin_menu_tools( $submenu_title, $url, $submenu_id,$capability = null, $icon_url = null ) osc_admin_menu_users( $submenu_title, $url, $submenu_id, $capability = null, $icon_url = null ) osc_admin_menu_stats( $submenu_title, $url, $submenu_id, $capability = null, $icon_url = null )
Examples:
osc_add_admin_menu_page( __('Listing'), // menu title osc_admin_base_url(true).'?page=items', // menu url 'items', // menu id 'moderator' // capability ) ;
osc_add_admin_submenu_page( 'items', // menu id __('Manage listings'), // submenu title osc_admin_base_url(true).'?page=items', // submenu url 'items_manage', // submenu id 'moderator' // capability ) ; ...