StudioPress page order
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:
- In the WordPress admin panel, go to Appearance > Editor and open up header.php
- 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’);
- Change the last part order by ID’); into order by menu_order’);
- 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!
September 16th, 2011 at 10:47
Wow! Thanks for that page order tip for Studiopress… I was going crazy with that!
I kept trying to get the theme to work with the standard WordPress wp_list_pages() function…
I’m going to put up a link to your blog for some backlink goodness… the site is still a work in progress, but you will see…
:)
September 16th, 2011 at 11:15
You’re welcome and thanks for the link. :D
I knew blogging about it would be helpful for some one. ;)