Is there any way I can get the items of a menu element in wordpress and then, iterating with PHP, for each of its elements get again its submenu elements if there’s any?
I would like to create a custom list and it seeems to me this is easier than dealing with the Walker function.
I see that the question is old, but this might be a solution to your problem (and others in the future) 🙂
This will loop trough the whole menu, and while in the loop, you can create if-statements if there is a parent or a child.
Here is all the avalible data in the
menu_items
object.To access them, just do like this in the loop:
$menu_item->menu_order
. That will give you1
The code is from the WordPress docs, you can read more there: wp_get_nav_menu_items