3

I am building a plugin that has a custom menu with pages under that menu. A few of those pages are custom post types. I would like to have the main menu stay open when I am on one of those custom post types. Is that possible?

Here is what the menu looks like when I'm on a non-custom post type page:

Open Menu

But when I click on Makes, Models or Types, the "Squirrels" menu closes because those are managed by the custom post type system.

Sorry if this is a duplicate. I looked through some similar questions but didn't see one that had exactly this same issue.

Thanks!

4

I figured this out by putting the main menu slug into the show_in_menu key of the custom post type array like so:

$args = array (
        'labels' => $labels,
        'hierarchical' => FALSE,
        'description' => $title . 's',
        'supports' => array( 'title' ),
        'show_ui' => TRUE,
        'show_in_menu' => 'squirrels_inventory',
        'show_in_nav_menus' => TRUE,
        'publicly_queryable' => TRUE,
        'exclude_from_search' => FALSE,
        'has_archive' => TRUE
    );
| improve this answer | |

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.