WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

managed to create a custom menu area in the admin but now want to place 2 post types to it.

They already exist - questions & answers, but can't find a way to put their menu links into the custom menu.

add_action('admin_menu', 'mt_add_pages');

function mt_add_pages() {

    add_menu_page(__('Competition','comp'), __('Competition','comp'), 'manage_options', 'mt-top-level-handle', 'test_func', '', 5 );
    add_submenu_page('mt-top-level-handle', __('Answers','comp-answers'),  __('Answers','comp-answers'), 'manage_options', 'sub-page', 'test_func2');

}

function test_func(){
    echo 1; // question post_type links
}

function test_func2(){
    echo 2; // answer post_type links
}

any help appreciated!

share|improve this question

Try adding the action after the function like this:

function mt_add_pages() {
    // Add theme options page to the addmin menu
    add_menu_page(__('Competition','comp'), __('Competition','comp'), 'manage_options', 'mt-top-level-handle', 'test_func', '', 5 );
    add_submenu_page('mt-top-level-handle', __('Answers','comp-answers'),  __('Answers','comp-answers'), 'manage_options', 'sub-page', 'test_func2');
}
add_action( 'admin_menu', 'mt_add_pages' );
share|improve this answer
up vote 0 down vote accepted

ended up defining it in the register_post_type function...

'show_in_menu' => 'mt-top-level-handle'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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