Hey Guys,
I’m trying to build a right aligned, wrapping capable wp_nav_menu powered menu.
Is there a way to have it rendered backwards, so that float: right; would work and not mess up the order?
I was hoping for something like this:
<?php wp_nav_menu( array('sort_order' => 'DESC' )); ?>
Thanks!
3 s
I just found this handy little function that ads the ability to reverse the menu output order. it might come in handy:
/**
* Enables a 'reverse' option for wp_nav_menu to reverse the order of menu
* items. Usage:
*
* wp_nav_menu(array('reverse' => TRUE, ...));
*/
function my_reverse_nav_menu($menu, $args) {
if (isset($args->reverse) && $args->reverse) {
return array_reverse($menu);
}
return $menu;
}
add_filter('wp_nav_menu_objects', 'my_reverse_nav_menu', 10, 2);
All you need to do is ad 'reverse' => true
as one of the wp_nav_menu parameters. 🙂
this is the source: https://gist.github.com/1291914