• Hi,
    I have added Main menu in admin side. i used the following code.

    add_action(‘admin_menu’, ‘my_plugin_menu’);

    function my_plugin_menu() {

    add_menu_page(‘Top Heading Menu’, ‘Own Heading’, 8, ‘own-heading’, ‘own_heading’);
    }

    I need to add sub menu under this main menu. Help would be appreciated. Please help me to figure this out.

Viewing 1 replies (of 1 total)
  • I am trying to do the same thing.
    Did you solve it?
    my code is as follows and shows the top menu and dispalys the content of the sub menu but not a submenu tab.
    `
    // mt_add_pages() is the sink function for the ‘admin_menu’ hook
    function mt_add_pages()
    {
    // Add a new top-level menu:
    // The first parameter is the Page name(Site Help), second is the Menu name(Help)
    //and the number(5) is the user level that gets access
    add_menu_page(‘Site Help’, ‘Help’, 5, __FILE__, ‘mt_toplevel_page’);
    add_submenu_page(‘__FILE__’,’Site Help’,’Authors’,5,__FILE__,’submenu_1′);
    }

    // mt_toplevel_page() displays the page content for the custom Test Toplevel menu
    function mt_toplevel_page() {
    echo ‘
    <div class=”wrap”>
    <h2>Site Help</h2>
    //content
    </div>
    ‘;
    }
    function submenu_1(){
    echo “hello World”;
    }
    // Insert the mt_add_pages() sink into the plugin hook list for ‘admin_menu’
    add_action(‘admin_menu’, ‘mt_add_pages’);
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘How to add custome sub menu in admin side’ is closed to new replies.