A way to activate menu trail
Under some circumstances it would be great if you could force WordPress to highlight a certain menu trail (down to a specified menu item) and let it do the magic as it usually does (assigning current- classes to appropriate menu items).
Assuming custom menu structure below I imagine I could do this like so:
|- Item 1.1
|- Item 1.1.1
|- Item 1.2
array('active_trail_item' => wp_get_menu_item_by_id( 21 ))
wp_get_menu_item_by_id users could also find such function useful
Look up 'breadcrumbs' - You can do this.
@Ipstenu: I guess I didn't make myself clear enough. I understand breadcrumbs can be installed and shown via a plugin (e.g. Breadcrumbs NavXT). But when you have a slightly more complex menu structure as shown above it would be great if a user could tell wordpress where in the menu it should think it is.
Consider this schema:
|- Page 2 (custom template that lists category archives)
|- Category 1
|- Page 3
In the example above when one opens up a a single post from Category 1 the navigation should assign .current-something to Page 1, Page 2 and Category 1 as well; which it does not now. As far as I know WP is not aware which post belongs to which part of menu so a manual activation is needed.
Have I made things any clearer? Thanks for being patient with me :)
The problem is associating the items back up the chain. Breadcrubs work well for posts and pages (and categories) when organized traditionally. When you're crossing over like your example, there's no way to magically detect that Page 2 belongs with Cat 1, so there's no way to code that in WP without using meta data, I suspect.
This would be something to work out as a plugin first.
(FYI - My theme handles breadcrumbs just fine, no plugins needed)
@Ipstenu: I hope I'll get the hang of WP soon and be able to write a decent plugin that does what I asked for above.
Meanwhile, if someone else finds this idea worth including in the WP core, I'll be here to help with additional use cases.
RSS feed for this topic
You must log in to post.