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.

Effect of releasing my plugin

Probably the most exciting thing that has happened around here in the past month or so is the release of my WordPress plugin. I spent a good amount of time exchanging e-mail with people about it and I’ve started to get more comments. So what has the plugin done for my site’s traffic? Check out the numbers for yourself, I released it the last few days of January 2006.

Month Unique visitors
Oct-05 76
Nov-05 165
Dec-05 331
Jan-06 329
Feb-06 1113

For the plugin itself I’ve had about 650 downloads, but a number of those might be repeats for upgrading. Hopefully I’ll have something a little more interesting to post about soon, school and work are time, motivation, and creativity killers.

And boo, the wordpress editor that comes with 2.0.1 doesn’t like tables for some reason. Have to install a more advanced one.

WordPress – Theme Editor: Alphabetical File Sorting

A quick fix some people might be interested in is how to sort the files listed on the theme editor page alphabetically. Some themes can have a large number of files and the default WordPress coding puts the list in no particular coding, making it difficult to track down a particular page. The addition of 2 lines of code can order the list to make it easier to work with.

  1. Save a copy of wp-admin/theme-editor.php to your local computer
  2. Backup the original version
  3. Open the local copy with a plain text editor (notepad works nicely)
  4. Around line 35 there should be a statement identical to:
    $allowed_files = array_merge($themes[$theme][‘Stylesheet Files’], $themes[$theme][‘Template Files’]);
  5. After this insert the following two lines directly after:
    natcasesort($allowed_files);
    $allowed_files = array_values($allowed_files);
  6. Save your copy and upload it back to the server
  7. Presto, list of files is now in alphabetical order

This will order by filename, but some files might display aliases like “Stylesheet” instead of styles.css, but it will still sort using styles.css, just be aware of that.

WordPress Plugin – My Link Order – Manually set order of Links and Categories

I’ve taken the time to create a plugin to address the fact that some WordPress users would like to have more control over the order their link categories and links in each category. Sure you can order by name or id or recently updated or this and that but what about setting an explicit order?

I actually had this idea last year when I wrote my own simplistic blog software and was dissapointed by the link management options WordPress had. So instead of complaining I did something about it.

Right now the plugin is fairly simplistic, check out these screenshots for a quick preview.

My Link Order Screenshot 1 My Link Order Screenshot 2

For more info click on the tab in the horizontal navigation bar or click through to http://geekyweekly.com/mylinkorder/.