wp_list_pages Title attribute and Order

I found a post on this site to add a custom "mytheme_list_pages" to the functions.php file in order to add the title attribute to a link. While this works to add the title attribute to the "href" output, it no longer preserves the order of the menu as wp_list_pages does. Can someone tell me how to order the output of the custom code below?

I'm calling the function from my page.php file like this:

<?php mytheme_list_pages('exclude=819&title_li='); ?>

The custom function below:

<?php 
function mytheme_list_pages($param) {
  $pages = get_pages($param); 
  foreach ( $pages as $page ) {
    $li  = '<li><a href="' . get_page_link( $page->ID ) . '" title="';
    $li .= esc_attr($page->post_title);
    $li .= '">';
    $li .= $page->post_title;
    $li .= '</a></li>';
    echo $li;
  }
}
?>

Many thanks!

Answers


Here is updated code,

    <?php mytheme_list_pages('exclude=819&title_li=&sort_column=menu_order'); ?>

<?php 
function mytheme_list_pages($param) {
  $pages = get_pages($param); 
  foreach ( $pages as $page ) {
    $li  = '<li><a href="' . get_page_link( $page->ID ) . '" title="';
    $li .= esc_attr($page->post_title);
    $li .= '">';
    $li .= $page->post_title;
    $li .= '</a></li>';
    echo $li;
  }
}
?>

for more information http://codex.wordpress.org/Function_Reference/get_pages


Need Your Help

CSS floating and positioning

css position margin floating

I have 2 boxes that should show up next to eachother. I want one to have a vertical fixed position.

properly simulate asp:Login's Logout function in siteMap

c# html asp.net sitemap logout

just as the title says, how do you properly implement/simulate the Logout function in asp:Login to a siteMapNode?