wordpress admin sidebar

Discussion in 'WordPress' started by mezner, Jun 18, 2010.

  1. #1
    I want to add in another level to the sidebar on the admin wordpress panel. I installed a theme and it added another level, but I'm not sure how I would go about doing it myself. I tried doing a search on the admin sidebar, but I came up empty. How would I go about doing something like this?

    Here is a picture of what I'm talking about. As you can see, it added a new level called "Bueno".
    [​IMG]
     
    mezner, Jun 18, 2010 IP
  2. mezner

    mezner Peon

    Messages:
    289
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I found a decent solution. This solution is really simple.

    function.php
    $functions_path = TEMPLATEPATH . '/functions/';
    require_once ($functions_path . 'menu.php');
    PHP:
    menu.php inside the functions folder
    <?php
    
    // Hook for adding admin menus
    add_action('admin_menu', 'mt_add_pages');
    
    // action function for above hook
    function mt_add_pages() {
        // Add a new submenu under Settings:
        add_options_page(__('Test Settings','menu-test'), __('Test Settings','menu-test'), 'manage_options', 'testsettings', 'mt_settings_page');
    
        // Add a new submenu under Tools:
        add_management_page( __('Test Tools','menu-test'), __('Test Tools','menu-test'), 'manage_options', 'testtools', 'mt_tools_page');
    
        // Add a new top-level menu (ill-advised):
        add_menu_page(__('Test Toplevel','menu-test'), __('Test Toplevel','menu-test'), 'manage_options', 'mt-top-level-handle', 'mt_toplevel_page' );
    
        // Add a submenu to the custom top-level menu:
        add_submenu_page('mt-top-level-handle', __('Test Sublevel','menu-test'), __('Test Sublevel','menu-test'), 'manage_options', 'sub-page', 'mt_sublevel_page');
    
        // Add a second submenu to the custom top-level menu:
        add_submenu_page('mt-top-level-handle', __('Test Sublevel 2','menu-test'), __('Test Sublevel 2','menu-test'), 'manage_options', 'sub-page2', 'mt_sublevel_page2');
    }
    
    // mt_settings_page() displays the page content for the Test settings submenu
    function mt_settings_page() {
        echo "<h2>" . __( 'Test Settings', 'menu-test' ) . "</h2>";
    }
    
    // mt_tools_page() displays the page content for the Test Tools submenu
    function mt_tools_page() {
        echo "<h2>" . __( 'Test Tools', 'menu-test' ) . "</h2>";
    }
    
    // mt_toplevel_page() displays the page content for the custom Test Toplevel menu
    function mt_toplevel_page() {
        echo "<h2>" . __( 'Test Toplevel', 'menu-test' ) . "</h2>";
    }
    
    // mt_sublevel_page() displays the page content for the first submenu
    // of the custom Test Toplevel menu
    function mt_sublevel_page() {
        echo "<h2>" . __( 'Test Sublevel', 'menu-test' ) . "</h2>";
    }
    
    // mt_sublevel_page2() displays the page content for the second submenu
    // of the custom Test Toplevel menu
    function mt_sublevel_page2() {
        echo "<h2>" . __( 'Test Sublevel2', 'menu-test' ) . "</h2>";
    }
    
    ?>
    
    PHP:
     
    mezner, Jun 20, 2010 IP
  3. solutionman

    solutionman Peon

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    @ Mezner : thank for your sharing, I will try it ...........
     
    solutionman, Jun 20, 2010 IP