0

I am trying to order the output of one of my menus to be based off of the way they are setup in the Appearance->Menus pane, however it seems to only want to do it alphabetically.

For example I have setup in the Menus pane the following hierarchy:

Weekly Outlook
- Webinars
- Calendar

However it displays like so:

Weekly Outlook
- Calendar
- Webinars

I the menu is generated by the following code. Note, the content is dependant on the page visited.

 <div id="dep-menu">
 <?php global $post;
 if (!is_front_page() && !is_404()) {
     if($post->post_parent) {
         $children = wp_list_pages("title_li=&include=".$post->post_parent."&echo=0&sort_column=menu_order'");
         $children.= wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&sort_column=menu_order'");
     } else {
         $children = wp_list_pages("title_li=&include=".$post->ID."&echo=0&sort_column=menu_order'");
         $children.= wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&sort_column=menu_order'");
     }
     if ($children) { ?>
         <ul>
             <?php echo $children; ?>
         </ul>
     <?php }
 }
 ?>
 </div>

EDIT

Here it is in action: http://dailywealthreport.com.au/

The menu I am referring to is the one that comes up when you click on an item in the main menu.

2
  • 1
    Shouldn't you be using the wp_nav_menu function? Commented Mar 28, 2012 at 3:42
  • possibly, I don't want it to be a "page menu" it's essentially a glorified breadcrumbs only it point's "forward"
    – Joshua
    Commented Mar 28, 2012 at 3:55

1 Answer 1

0

For 'menu_order' to work, you need to set the page order from the page edit screen. Are you setting orders for your pages?

2
  • 1
    I edited the post to link to the page in question. The "main menu" is done with wp_nav_menu and it includes the child pages. I want to echo those child pages in accordance with the order set out in the menu order.
    – Joshua
    Commented Mar 28, 2012 at 4:06
  • I got your point, but as you're using wp_list_pages, there doesn't seem to be a straight way to do it. I guess using wp_nav_menu itself by excluding the parent will do your job. Commented Mar 28, 2012 at 4:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.