Skip to content

Instantly share code, notes, and snippets.

@mnmldave
Created October 17, 2011 03:59
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnmldave/1291914 to your computer and use it in GitHub Desktop.
Save mnmldave/1291914 to your computer and use it in GitHub Desktop.
Reverse wordpress nav menu
/**
* 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);
@mradulovic988
Copy link

Thanks man. Awesome solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment