Wednesday, October 27, 2010

wordpress admin menu page

/* Plugin Name: Simple Admin Menu */

add_action('admin_menu', 'mt_add_pages');

function mt_add_pages() {
add_menu_page('Main Page','Main Page', 'manage_options', 'main-page-handle', 'main_page' );
add_submenu_page('main-page-handle','Sub Page1', 'Sub Page1', 'manage_options', 'sub-page1', 'sub_page1');
add_submenu_page('main-page-handle', 'Sub Page2', 'Sub Page2', 'manage_options', 'sub-page2', 'sub_page2');
}

function main_page() {
echo "Main Page";
}

function sub_page1() {
echo "Sub Page1";
}

function sub_page2() {
echo "Sub Page2";
}

No comments:

Post a Comment