tags:

views:

42

answers:

2

It was easy enough to get my custom fields to show up as columns in the wp-admin area of my custom post type but now I need to sort by one of those custom fields. Any ideas?

A: 

But of course. This will sort posts by the value of the pant_size custom field:

$posts = query_posts('orderby=meta_value&meta_key=pant_size&order=DESC');

You can read more about it in this article.

Pat
Thanks for answering! Wordpress help is a waistland here. Anyway, that's for when you want to display the posts to the user, not the admin area where you can edit the custom posts and that's where I want to change the sorting. I'm thinking maybe I can do it with Javascript and make all the columns sortable while I'm at it but that probably won't work because of paging.
tooshel
A: 

Hopefully the answer to this will end up on the Wordpress stackexchange site.

tooshel
It did! The answer there is wonderful just in case you happen to end up here instead.
tooshel