jchristopher / menu-breadcrumb

[WordPress Plugin] Generate a breadcrumb trail from a WordPress Menu
GNU General Public License v2.0
20 stars 9 forks source link

Doesn't find crumbs for news that are not on the front page #4

Open benjaminpick opened 9 years ago

benjaminpick commented 9 years ago

I am using a static page as front page, and a different one for the news. Currently, the Breadcrumbs of the news overview page & news detail page do not show.

(While debugging, I realized that wp_get_nav_menu_items never returns items with "current", so he is only comparing URLs.)

benjaminpick commented 9 years ago

Reading the WP code, I found that the current class is only added in the method _wp_menu_item_classes_by_context() - which is private. So we should get the menu items via the filter wp_nav_menu_objects - this would also have the advantage that they are already in a hierachical order.

I will try to write a pull request.

jchristopher commented 9 years ago

This is great @benjaminpick — as with your other two PRs it'd be awesome for this to get updated to master and rolled in, thank you again for taking the time on these improvements!

benjaminpick commented 9 years ago

Updates now.