Support » Fixing WordPress » Top level menu to list pages and categories – change order

  • 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:

    <?php wp_list_pages('title_li='); ?>
    <?php wp_list_categories('depth=1&title_li='); ?>

    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:

    <?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='); ?>

    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?


  • The topic ‘Top level menu to list pages and categories – change order’ is closed to new replies.