Im trying to get the id of the menu item that has be class called "current-menu-item". Not the current page id, but the nav item id.
Please help
|
Im trying to get the id of the menu item that has be class called "current-menu-item". Not the current page id, but the nav item id. Please help |
|||
|
|
This should solve it How to get current-menu-item title as variable? but change
to
and now you can use the global variable |
||||
|
|
|
The best way would be to use the
|
|||||||
|
|
A little late perhaps, but there is one more way of doing it:
Since menu items are post-types you are able to use all the WP-Query params, even a meta query. The code above selects all menu_items which are connected to the current post, from the menu you specify via |
|||
|
|