blog

Archive for November, 2008

Just sat next to the Japanese doppelgänger of my old cute French neighbor.

— November 30th, 2008 10:39 am

Saw a Prius taxi.

— November 30th, 2008 2:07 am

iPhone emoji gets it right: I can wink and stick my tongue out at the same time.

— November 30th, 2008 1:26 am

Why did the invoice for my GRE score reports come from Germany?

— November 30th, 2008 12:41 am

External orders in WordPress queries

Saturday, November 29th, 2008

The advanced WordPress user is intimately familiar with query_posts, the function which controls which posts are displayed in “The Loop.” query_posts gives plugin and theme writers the ability to display only posts written in Janary (query_posts("monthnum=1")) or disallow posts from a certain category (query_posts("cat=-529")1). One of the parameters you can set here is orderby which affects the ordering of the posts returned, with allowed values such as author, date, or title. But what if you want to order your posts in some other order, defined outside of your wp_posts table? Here I’m going to lay out some thoughts on rolling your own external ordering source for WordPress queries.

In order to introduce an external ordering source, we need to do four things: 1. create the external ordering source, 2. hook up (read “join”) the external ordering source 3. make sure we use that order, and 4. make it play nice. ^^

By the way, I’m going to assume you, dear reader, are PHP-savvy, proficient in MySQL, and already know a little about WordPress. This how-to is not for the PHPhobic.

(more…)


  1. This, incidentally, is precisely what I do to hide, by default, my tweets in my index.php and archives.php

Made soup… and then discovered this kitchen doesn’t have a ladle. :(

— November 29th, 2008 9:26 am

Have you heard Blitzen Trapper’s Furr @mwieg? It’s like a CSNY+Wilco+Of Montreal+Flaming Lips+Steely Dan mixtape. No joke.

— November 29th, 2008 6:38 am

It’s Dupin time.

— November 29th, 2008 6:27 am

iPhone 2.2 includes emoji for “love hotel.”

— November 29th, 2008 2:12 am

David Sedaris does a great Billy Holliday impression.

— November 28th, 2008 9:21 am

searching my gmail for “from:me to:me”

— November 28th, 2008 3:36 am

Slept for 11 hours last night.

— November 28th, 2008 12:37 am

This weather is not helping my fragile system. Waah.

— November 27th, 2008 1:06 am

On the way to a Thanksgiving dinner.

— November 26th, 2008 9:52 am

Am I getting sick? Time to try the Hong Kong ginger tea at the office!

— November 26th, 2008 6:45 am

© 2006-2008 mitcho (Michael 芳貴 Erlewine).
Proudly powered by WordPress.
Entries (RSS) and Comments (RSS).
The views expressed on these pages are mine alone and do not
reflect those of my employers and clients, past and present.