I know, this blog is about music, but since I tweak the code of my own website, I sometimes run into problems. So I’m blogging this, because I had a hard time finding the answer and hopefully Google will send them here. So music lovers, just ignore this post. ;)

The Problem: page order in StudioPress

My blog runs on WordPress and at the moment uses the StudioPress theme by DailyBlogTips. I made several pages but wanted to re-order them, but couldn’t. Whatever I did, whatever plugin I installed to fix this, the order stayed the same: the order in which they were created.

The Cause: get_the_pa_ges

StudioPress does not use the default code to fetch your pages (wp_list_pages). Instead the creator of StudioPress decided to use his own function to do this: get_the_pages. This is probably why all those plugins to order pages don’t work. Yet. With one little fix in the code I could let My Page Order finally do it.

The Fix: menu_order instead of ID

I have to be honest and say I found this fix after browsing through all the comments on this page . Try this, it may work for you:

  1. In the WordPress admin panel, go to Appearance > Editor and open up header.php
  2. Find the lines that say: $these_pages = $wpdb->get_results(‘select ID, post_title from ‘. $wpdb->posts .’ where post_status = “publish” and post_type = “page” order by ID’);
  3. Change the last part order by ID’); into order by menu_order’);
  4. If needed, install and use My Page Order to alter the order of the pages.

This worked for me. If this doesn’t work for you, please don’t ask me, but consult the makers of StudioPress or this page, since I’m not an expert in either WordPress, StudioPress or php. I just figured this out using Google and a lot of patience too.

Like this? Buy me a drink!