WordPress – Admin Menu – Sub Sub Page?

I’ve added custom menus to the admin menu in the backend, and I almost always have sub pages, but is it possible to have a 3rd level of page, or “sub sub menu pages”?

Snippet of code:

Read More
add_action('admin_menu',array(new mmr_menu((isset($_GET['page']) ? $_GET['page'] : "mmr")),'mk_menu'));

class mmr_menu{
    public function mk_menu(){

        add_menu_page('MMR', 'MMR', 'administrator', PLUGIN_PREFIX.'mmr', array(&$this,'get_page'), PLUGIN_DIR.'inc/images/logo.gif');

        add_submenu_page(PLUGIN_PREFIX.'mmr', PLUGIN_PREFIX.'app_and_reg', 'Applications & Registrations', 'administrator', PLUGIN_PREFIX.'app_and_reg', array(&$this,"get_page"));

        // Doesn't work
        add_submenu_page(PLUGIN_PREFIX.'app_and_reg', PLUGIN_PREFIX.'payment_reports', 'Payments', 'administrator', PLUGIN_PREFIX.'payment_reports', array(&$this,"get_page"));
    }
}

PLUGIN_PREFIX and PLUGIN_DIR are defines, and mmr_menu->get_page() is a public method that I didn’t think was necessary to include.

Related posts

Leave a Reply

1 comment

  1. Usually plugin authors create tabs for 3rd level pages. These are not registered as seperate pages, but you can add a query arg to select the page, and link to the different tabs that way.
    Example:

    <?php
    function payment_reports() {
    
        // first, lets print out the tabs ?>
        <ul class="tabs">
             <a href="[sub-page url]&tab=first">Tab 1</a>
             <a href="[sub-page url]&tab=second">Tab 2</a>
             <a href="[sub-page url]&tab=third">Tab 3</a>
        </ul><?php
    
        switch ($_GET['tab']) {
            case 'second':
                output_first_tab();
                break;
            case 'third':
                output_first_tab();
                break;
            default:
                output_first_tab();
        }
    
    
    }
    
    ?>
    

    Having said that, some wordpress frameworks (link piklist) have support for 3rd level tabs built in