Friday, February 3, 2012

How to add administration menus in wordpress


This article explains how plugin authors can add administration menus.

Using Wrapper Functions

Since most sub-level menus belong under the Settings, Tools, or Appearance menus, WordPress supplies wrapper functions that make adding a sub-level menu items to those top-level menus easier. Note that the function names may not match the names seen in the admin UI as they have changed over time:

Dashboard
<?php add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Posts
<?php add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Media
<?php add_media_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Links
<?php add_links_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Pages
<?php add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Comments
<?php add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Appearance
<?php add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Plugins
<?php add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Users
<?php add_users_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Tools
<?php add_management_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Settings
<?php add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>

More:Here is an example of a WordPress plugin that inserts new menus into various places:
 Administration_Menus

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.