widgets in the primary sidebar of a new project need to be treated differently, depending on the sub-menu area where they are displayed.
I created a custom menu with a mixture of (sub-)pages and categories (in the 2nd level of the custom menu).
- category 1
- sub-page 1.1
- sub-page 1.2
In order to be able to display the right widgets in the right place I would need a function like get_ancestors_in_custom_menu(), which does not exist. This function would return the ID of the parent menu item, or an array of the IDs of the parent/ancestor items.
WordPress provides some functions concerning the page or category hierarchy, but no function returning info about the hierarchy of a custom menu. As far as I can see.
What could I use/do for getting the ID of the top level parent menu item within a custom menu?
(I hope I could express what I mean 🙂
Thank you in advance.
The topic ‘need for something like 'get_ancestors_in_custom_menu()'’ is closed to new replies.