I have a custom menu using the new Menu System but it is not returning in the correct order. I have no idea what order its in – its not alphabetical, or by date, or by any pattern I can see.
The link is http://www.oia.co.za/.
The pages “sponsors”, “archives” and “fewtchafests” are supposed to appear as the last 3 items, after the series of numbers, not before them. If the first item wasn’t also a number, I might think it was rendering all numbers last, but that first item (“8333”) kind of scuppers that idea.
Screenshot of correctly dragged-and-dropped menu order attached, screenshot of website displaying wrong order attached, and the code used to call the menu is below.
<!-- BEGIN ADVENT CALENDAR -->
<nav role="navigation">
<?php
wp_nav_menu( array(
'theme_location' => 'advent-calendar',
'menu' => 'advent-calendar',
'menu_class' => 'component-calendar',
'container_id' => 'calendar',
'container_class' => 'advent',
'orderby' => 'menu_order',
'walker'=> new Salamander_Advent_Walker()
)
);
?>
</nav>
<!-- END ADVENT CALENDAR -->
EDIT: It’s definitely a problem with my custom walker (code below) – if I comment out the call to the custom walker function, it generates in the right order:
class Salamander_Advent_Walker extends Walker_page {
function start_el(&$output, $item, $depth, $args) {
private $color_idx = 1;
$advent_thumbnail = get_post_meta($item->object_id, 'advent-thumb', true);
$advent_slug = get_post_meta($item->object_id, 'advent-slug', true);
$advent_oneliner = get_post_meta($item->object_id, 'advent-oneliner', true);
$advent_color = get_post_meta($item->object_id, 'advent-color', true);
$advent_small_title = get_post_meta($item->object_id, 'advent-title', true);
$advent_title = ( !empty($advent_small_title) ? $advent_small_title : $advent_slug);
$output .= $indent . '
<li class="color'.$this->color_idx.' active">
<a href="#day'. $advent_slug .'">
<span class="day">
<strong>'. $advent_slug .'</strong>
<span> </span>
</span>
<span class="content">
<small class="'. $advent_color .'">'. $advent_title .'</small>
<img src="'. $advent_thumbnail .'" width="126" height="91" alt="advent" />
<strong>'. $advent_oneliner .'</strong>
</span>
</a>
';
$this->color_idx++;
if ($this->color_idx > 4) {
$this->color_idx = 1;
}
} // ends function
} // ends class