Add New Menu Item In WordPress Admin

You can add Menu Items to admin in wordpress without use a plugin by using Hooks as following:

1- The function you will use For Menu Item is “add_menu_page();”

<?php

add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );

?>

For more details about Function param visit: Add Menu Wordpress Codex

2-  The function you will use For SubMenu Item is “add_submenu_page();”

<?php

add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function );

?>

For more details about Function param visit: Add Submenu Wordpress Codex

/*

*   Example for menu & submenu Items:
*/

function my_menu_pages(){
add_menu_page(‘My Page Title’, ‘Homepage’, ‘manage_options’, ‘cat9′, ‘my_menu_output’,’/wp-admin/images/generic.png’,’4.1′);
      add_submenu_page(‘cat9′, ‘Homepage Slides’, ‘Homepage Slides’, ‘manage_options’, ‘edit.php?cat=20′);
}

add_action(‘admin_menu’, ‘my_menu_pages’);

/*

* End

*/

About these ads

2 thoughts on “Add New Menu Item In WordPress Admin

  1. Pingback: Reorder Menu Item In WordPress Admin « bishoyfawzy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s