WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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' )); ?>


share|improve this question
up vote 5 down vote accepted

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

share|improve this answer

You could write a custom walker for your wp_nav_menu() call. Short of that, I don't think there's anyway to do what you're trying to do.

You could pass such arguments to your fallback function (e.g. wp_list_pages() or wp_page_menu()), but the list-item order of wp_nav_menu() is entirely dependent upon the user-defined menu applied to the given menu location.

share|improve this answer
Thanks Chip! It's not often you "can't" do something in WordPress. Funny you answered this question, I just emailed you through your website about a plugin question! What a coincidence! – Drew Baker Apr 18 '11 at 18:40

oops! or try like this

<?php $args = array( 'sort_column' => 'menu_order, post_title' ); ?>

for more parameters http://codex.wordpress.org/Function_Reference/wp_page_menu

share|improve this answer
this might help you http://codex.wordpress.org/Function_Reference/wp_nav_menu – Umarfaruk M Dec 29 '11 at 12:28
Please edit your answer to add details instead of creating multiple answers. – Rarst Dec 29 '11 at 13:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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