WordPress.org

Ready to get started?Download WordPress

Forums

page order: child independent from parent - how? (2 posts)

  1. shoryuken
    Member
    Posted 8 years ago #

    I was trying to configure my sidebar to my needs and I have the problem that I want to sort the child pages different from the parent pages.

    example

    * Main
    * Downloads
    * Links
    o Racetracks
    o Software
    o Food
    * About
    * Disclaimer

    Now I have used the following code:
    <?php wp_list_pages('sort_column=menu_order&title_li='); ?>

    The pages are currently all sorted by menu_order (although all child pages have '0' values.

    Is it possible to have the child pages sorted by 'column_title' but at the same time leave the parent page order at 'menu_order'?

    Of course I could set the proper menu_orders for the child pages as well (too bothersome). Or I could use three different code pieces that exlude one another.

    example

    * Main
    * Downloads
    ----------------------->
    * Links
    o Food
    o Racetracks
    o Software
    ----------------------->
    * About
    * Disclaimer

    But this is rather troublesome with a growing number of pages.
    I wonder if there is a more elegant method within the wp_list_pages tag...

  2. moody
    Member
    Posted 8 years ago #

    Is it possible to have the child pages sorted by 'column_title' but at the same time leave the parent page order at 'menu_order'?

    A bit late on a reply, but after all my testing and tweaking, I would have to say no.
    It'll be best to have your children with values with the Page Order variable in the Page section.

    Then you can use something like this:
    <?php wp_list_pages('title_li=&child_of=5&sort_column=menu_order'); ?>

    maybe?

Topic Closed

This topic has been closed to new replies.

About this Topic