Below is my code, the code generates a user custom options menu page, after adding the sub menu page, when I click the sub menu option, the page refreshes but the sub menu page content is not visible, only the main page content sticks. Please help me to where I am wrong. Do I have to register_setting or any thing else....
<?php
// create custom plugin settings menu
add_action('admin_menu', 'omr_create_menu');
add_action('admin_menu', 'omr_create_submenu');
function omr_create_menu() {
//create new top-level menu
add_menu_page('My Menu Page', 'Main Menu', 'administrator', __FILE__, 'main_menu_page', 'favicon.ico');
}
?>
<?php
function main_menu_page() {
global $title;
?>
<h2><?php echo $title;?></h2>
My New Menu Page!!
<?php
}
function omr_create_submenu(){
add_submenu_page(__FILE__, 'My SubMenu Page', 'My Submenu', 'administrator', 'my_new_submenu', 'my_submenu_page');
}
function my_submenu_page() {
global $title;
?>
<h2><?php echo $title;?></h2>
My New Submenu Page!!
<?php
}
?>
Originally asked by: Solomon Henry on Stack Overflow


Answers