0

I'm not sure on the terminology because a Google search isn't really sending me in the right direction.

I currently have a WordPress Plugin which is inside the settings tab.

I would like to have my own tab which has 3 subsections underneath it.

I've tried looking at these:

add_action('admin_menu', 'jobboard_admin_actions');
function jobboard_admin_actions() {
add_options_page('JobBoard', 'JobBoard', 'manage_options', __FILE__, 'JobBoard_admin');
}

But I'm still stuck.

Thanks,

Changes :

add_action('admin_menu', 'jobboard_admin_actions');
function jobboard_admin_actions() {
add_menu_page('JobBoard', 'JobBoard', 'manage_options', JobBoard_admin,  'JobBoard_admin', '');
add_submenu_page( 'JobBoard_admin', 'JobBoard', 'JobBoard', 'manage_options',    'JobBoard_admin', 'JobBoard_admin_delete' ); 

}
1

Here is something I used:

add_action( 'admin_menu', 'manage_poll_menu' );
function manage_poll_menu() {
    add_menu_page( 'Manage Polls', 'Polls', 'manage_polls_cap', 'manage_polls', 'my_poll_options', '' );
    add_submenu_page( 'manage_polls', 'Add New', 'Add New Poll', 'manage_polls_cap', 'add_new_poll', 'my_poll_options' );
    add_submenu_page( 'manage_polls', 'Poll Sections', 'Poll Sections', 'manage_polls_cap', 'poll_sections', 'my_poll_options' );
    add_submenu_page( 'manage_polls', 'Add New Poll Section', 'Add New Poll Section', 'manage_polls_cap', 'add_new_poll_section', 'my_poll_options' );
}
function my_poll_options() {
    if ( !current_user_can( 'manage_polls_cap' ) )  {
        wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    }

    echo '<div class="wrap">Page content</div>';
}

Also more information about Administration Menus and Submenu Pages you can find on here.

  • Hey Spartakus, thanks for the read. Really useful stuff :) Would you mind looking over something for me? I have edited the OP. I have it working if I use your manage polls example, but if I change some of the values it doesn't show the subpage. Thanks. – Bradly Spicer Jul 23 '13 at 11:01
  • 2
    Take attention to parent_slug add_submenu_page( $parent_slug, ...) it must be the same as menu_slug from add_menu_page( $page_title, $menu_title, $capability, $menu_slug, ...). Hope it helps. – Marin Bînzari Jul 23 '13 at 11:16
  • 1
    Nice to hear it! – Marin Bînzari Jul 23 '13 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.