0

I'm looking for a way to list three specific pages in a nav-menu (I want to get these pages by their unique page ID's), and also list the children of these three pages - appended to each list item, in a 'ul' of their own (So like a standard multi-tiered sub-nav type menu).

I've been trying to do this with wp_list_pages(), but child_of only takes one argument.

Help would be appreciated!

0

I think there's couple of ways doing this.

1) register_nav_menu, add your menu in Appearance > Menus to the registered menu location, then let wp_nav_menu handle the markup for you

2) register_nav_menu, add menu in Appearance > Menus, then use wp_get_nav_menu_items to get the menu items and write the html markup yourself.

3) Have an $array of parent page ID's (hardcoded or get them from an option/post_meta/wherever), do for/foreach/while loop with the array and use get_children inside it. You can either use to loop to simultaneously build the html markup or store the parent and child ID's to another $array and do the html loop later with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.