here is properties for that functions
add_menu_page(page_title, menu_title, access_level/capability, file, [function], [icon_url]); add_submenu_page(parent, page_title, menu_title, access_level/capability, file, [function]); basename(__FILE__)
by the way. when we create submenu using add_submenu_page function, we had unwanted sub menu item appear in the first submenu. this submenu is same as main menu like this..
Menu Tile
-Menu Title
-Sub Menu Title 1
-Sub Menu Title 2
we don't want Menu Title appear as a submenu. After googling, I found that other people also got a same problem. I do a research and debugging and finally I got the solution.
add_menu_page('Menu Title', 'Menu Title', 10, 'main_menu', 'sub_menu_1_callback'); add_submenu_page('main_menu', 'Sub Menu Title 1', 'Sub Menu Title 1', 10, 'main_menu' , 'sub_menu_1_callback'); add_submenu_page('main_menu', 'Sub Menu Title 2', 'Sub Menu Title 2', 10, 'sub_menu' , 'sub_menu_2_callback');
It's pretty simple.. just to make sure the first submenu file name is same as their parent file name. In my case, look at first add_submenu_page function file name, main_menu . I put same name as add_menu_page function file name.
Download Wordpress Submenu Sample Plugin