[wp-hackers] Menu classes for custom post types?
helen.y.hou at gmail.com
Wed Mar 2 21:46:36 UTC 2011
Shelly - show_in_menu is talking about the admin menu, not the nav menu GUI.
show_in_nav_menus is still fine in 3.1 as far as I know (somebody, please
yell at me if I'm wrong), but that only allows for selection of individual
items. You can add custom taxonomies and individual CPT items to nav menus
just fine, just not a 3.1 CPT archive. A page template is not the same as a
CPT archive. Also, the menu item CSS class you're talking about is always
applied, not just when viewing the relevant item. Your suspicion about the
body class is correct - only happening because of the page template.
Good reminder about the "Screen Options" thing, though - description might
also be hidden by default.
On Wed, Mar 2, 2011 at 4:05 PM, Foolish Visions
<shelly at foolishvisions.com>wrote:
> >>The only way to add these listings to menus seems to be via a custom
> 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?
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers