• Hi All

    I am creating a plugin which has several custom post types and I want to group them together in one menu.

    I have managed to get the menu structure working ok but when I click through to my custom post the menu closes, the custom post is highlighted when u roll over it but I want it to stay open

    My Menu Code is:

    function add_your_menu() {
    	add_menu_page( 'My Menu', 'My Menu Title', 'manage_options', 'my_menu_slug', 'my_admin_page', plugins_url( 'myPlugin/images/myIcon.png'), 6);
    	add_submenu_page( 'my_menu_slug', 'First Sub Menu Link', 'First Sub Menu Link Title', 'manage_options', 'edit.php?post_type=first_sub_menu');
    }
    add_action('admin_menu', 'add_your_menu');
    
    function my_admin_page(){
    ?>
    	<h1>Title</h1>
    <?
    }

    I have looked around but cant find a solution that works, please can someone help?

    [Moderator Note: No bumping. If it’s that urgent, consider hiring someone instead.]

Viewing 1 replies (of 1 total)
  • Thread Starter johnsimpson_uk

    (@johnsimpson_uk)

    Hi

    I have got a little further from yesterday but still struggling,

    I have changed route a little but its still not right really…

    Basically rather than creating a menu manually when adding custom post type, I am not set ‘show_in_menu’ argument – which creates menu for me.

    I then use this menu for other custom pages using add_submenu_page and use ‘edit.php?post_type=%%post_type_name%%’ as a parent slug.

    (taken from another forum here… https://stackoverflow.com/questions/20025481/wordpress-custom-taxonomy-link-not-highlighted-under-custom-admin-menu)

    This keeps the menu open when going between the different custom posts but the only problem with it now is that I have an “Add New” button in the side menu under my first custom post…. is there a way to stop this showing?

Viewing 1 replies (of 1 total)
  • The topic ‘Admin Menus / Sub Menus with Custom Post Types’ is closed to new replies.