WordPress.org

Ready to get started?Download WordPress

Forums

Top level menu to list pages and categories - change order (1 post)

  1. juxprose2
    Member
    Posted 5 years 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

Topic Closed

This topic has been closed to new replies.

About this Topic