[wp-hackers] Menu classes for custom post types?
shelly at foolishvisions.com
Wed Mar 2 21:05:03 UTC 2011
>>The only way to add these listings to menus seems to be via a custom link.<<
Interesting. Maybe I have it as a workaround? I dunno. All I know is, I'm working on a site right now where I'm using custom post types quite heavily. They are showing up in my Menu settings because I have:
'show_in_nav_menus' => true, // before 3.1.x
'show_in_menu' => true, // for 3.1.x
in my "register_post_type" call. I can link to my custom post type category or tag archives (or even individual posts), and I have a custom post type archive page created that shows up in my menus to choose from as well. (Perhaps because I actually created a Page, and set it with my custom post type template file? It *is* showing up under "Pages")
>>Consequently, there's no indication in the menu that you're on a current post type page, or ancestry when looking at one of the individual custom post type items.<<
You can add a CSS class to the menu item (make sure "CSS Classes" is checked under the "Screen Options") When I do it, it adds the custom post type class to the link itself, and the body tag also has a class that indicates it's within the custom post type area. My custom post type is "photos" and the body class is "page-template-archive-photos-php" - but again that last might be because I'm using a Page set for the archives?
I don't know - does that help?
More information about the wp-hackers