Open benjaminpick opened 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.
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!
Updates now.
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.)