Forums
Home / Fixing WordPress / Top level menu to list pages and categories – change order
(@juxprose2)
15 years, 4 months ago
I am trying to create a top level menu to list the following:
-Home (page / id7) -Exhibitions (category) -Commissions (category) -Music Promo’s (page / id6) -Shop (page / id4) -About (page / id2)
To achieve this, I feel this will do it:
<ul> <?php wp_list_pages('title_li='); ?> <?php wp_list_categories('depth=1&title_li='); ?> </ul>
However, this lists the menu as such:
-Home (page) -Music Promo’s (page) -Shop (page) -About (page) -Exhibitions (category) -Commissions (category)
I want to list them in my desired order. So I am doing this:
<ul> <?php wp_list_pages('depth=1&exclude=6,4,2&sort_column=menu_order&title_li='); ?> <?php wp_list_categories('depth=1&orderby=ID&title_li='); ?> <?php wp_list_pages('depth=1&exclude=7&sort_column=menu_order&title_li='); ?> </ul>
This works, but doesn’t seem right – I don’t want to repeat wp_list_pages twice, and go through all the excludes.
Is there a simpler way of doing this?
Thanks