WordPress – Sidebar Static Page Order

I got an e-mail today from someone who found my My Link Order plugin but wanted to order his pages instead. At first I wasn’t completely sure if you could but a quick look at the core files, database, and WP site answered that question.

Yes, you can set the order in which pages show up in your sidebar, but it is a little clunky. When you edit a page, there is an option to set the “Page Order” to a certain number (in WP 2.0 this is one the collapsable boxes). Now follow these steps:

  1. Set the Page Order on each page in your desired order.
  2. Check if that changes the order, if not you will need to make a change to your template to tell it to sort on that order instead of by name.
  3. Go to Presentation->Theme Editor and select the Sidebar page (I’m assuming this is where your list of pages is being displayed). Find the line that is using a function named wp_list_pages, the whole line should look something like this:<?php wp_list_pages(‘title_li=<h2>Pages</h2>’ ); ?>

    A parameter to tell it to sort by your order needs to be added:

    <?php wp_list_pages(‘title_li=<h2>Pages</h2>&sort_column=menu_order’ ); ?>

With that added your pages should now be sorted. I might create a plugin similar to My Link Order to handle the setting of orders because the current way is annoying and very very very user-unfriendly.

5 Replies to “WordPress – Sidebar Static Page Order”

  1. Thank you very much for this. The problem was driving me crazy on a site for a friend, and your solution worked like a dream. I’ll definitely use it again along with your My Page Order plugin. Excellent work.

Comments are closed.