How do I re-order links in sidebar menu?

ForumCategory: MenusHow do I re-order links in sidebar menu?
jgold723 asked 5 months ago

The page links that appear in the left-hand sidebar menu are arranged alphabetically. Is it possible to change this default arrangment?

2 Answers
jgold723 answered 5 months ago

I’ll answer my own question for others who might want to do the same.
The sidebar links are controlled in part by the wp_list_pages function which accepts different sorting options (among other arguments). You can find out more at: https://developer.wordpress.org/reference/functions/wp_list_pages/
The function is called in the uua-congregation them from lib/context-nav.php. You just add the argument ‘sort_column’ => ‘menu_order’, (if you want to sort by menu order, that is) around line 41 ($args = array).
One note — I couldn’t find a way to make this work in my child theme, so I had to hack the actual uua-congregation theme. This will be overridden if the theme is updated, so you’d want to make a copy of this file so you can replace it after a theme update.

cwjordan answered 4 months ago

According to other forum posts, the sidebar menus, as they are now, are arguably a bug in the theme.  Having a real menu there instead of a list of the page hierarchy would be much nicer.
However you can change the order by editing the page you want to reorder, going to the Page Attributes box (which you may need to make visible by going to Screen Options first) and then putting a number in the Order field and clicking “Update”.  You have to do this on a page by page basis, but you don’t have to change the php code in the theme to do it.