Forums

How can you reorder pages? (9 posts)

  1. luminousnerd
    Member
    Posted 5 years ago #

    Hi,
    I've looked and searched around but can't find a way to reorder your pages. I already modified the "Page Order" to be correct (About is 1, Important Posts is 2, Contact is 3) but still Contact appears before Important posts.

    Here's my blog: http://www.luminousnerd.com

    Thanks a ton

  2. Samuel B
    moderator
    Posted 5 years ago #

  3. luminousnerd
    Member
    Posted 5 years ago #

    Interesting plugin. I downloaded and installed it, but it looks to me as if that's more for categorising the pages? At any rate, I still can't get the order correct :(

  4. luminousnerd
    Member
    Posted 5 years ago #

    Any help?

    Thanks

  5. luminousnerd
    Member
    Posted 5 years ago #

    I don't understand, this should be just built in. A very simple feature...

  6. Kafkaesqui
    Moderator
    Posted 5 years ago #

    Have you checked the 'sort_column' and 'sort_order' parameters in wp_list_pages()?

    http://codex.wordpress.org/Template_Tags/wp_list_pages

  7. luminousnerd
    Member
    Posted 5 years ago #

    I don't understand that page, because the code is much more complex than that page suggests. See:


    <?php
    $pages = get_pages();
    if ($pages) {
    foreach ($pages as $page) {
    $page_id = $page->ID;
    $page_title = $page->post_title;
    $page_name = $page->post_name;
    if ($page_name == "archives") {
    (is_page($page_id) || is_archive() || is_search() || is_single())?$selected = ' class="selected"':$selected='';
    echo "<li".$selected."><a href=\"".get_page_link($page_id)."\">$page_title</a></li>n";
    }
    elseif($page_name == "about") {
    (is_page($page_id))?$selected = ' class="selected"':$selected='';
    echo "<li".$selected."><a href=\"".get_page_link($page_id)."\">$page_title</a></li>n";
    }
    elseif ($page_name == "contact") {
    (is_page($page_id))?$selected = ' class="selected"':$selected='';
    echo "<li".$selected."><a href=\"".get_page_link($page_id)."\">$page_title</a></li>n";
    }
    elseif ($page_name == "about_short") {/*ignore*/}
    else {
    (is_page($page_id))?$selected = ' class="selected"':$selected='';
    echo "<li".$selected."><a href=\"".get_page_link($page_id)."\">$page_title</a></li>n";
    }
    }
    }
    ?>

  8. Kafkaesqui
    Moderator
    Posted 5 years ago #

    I do so love theme designers...

    For starters, try changing the first line to:

    $pages = get_pages('sort_column=menu_order');

  9. luminousnerd
    Member
    Posted 5 years ago #

    Excellent. That fixed it. Thank you so much.

    Yea, I had to translate the theme from German XD

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags