Listing custom menu in wordpress in two stages
I need to list a custom menu in wordpress in two stages.
Now I use
wp_nav_menu(array('menu' => 'my menu'))
to list my whole custom menu. But I wo开发者_StackOverflowuld like to do something like that:
< list first half of 'my menu' >
display something else, few <div>s etc...
<list the other half of 'my menu' >
So my questions are:
- How can I get the exact number of links in my menu?
- Is there a way to list menu from the beginning to some point, and then the rest?
What you actually need to use is wp_get_nav_menu_items function, because it returns array of menu items. From that point it is just ordinary php to do what you want.
But, starting from the beginning, are you sure what you need is one menu, maybe better option would be to make two menus? Menus are just arrays of menu items, you can make many of them for different purposes.
精彩评论