Now with those custom post types and other bits of content that
don’t necessarily need to be organized chronologically by date, for
example: the client has a 100 T-Shirts as custom post type “SHIRT” and
he wants to set their appearance order.
What approach you suggest taking for letting the editor/admin of the
site SORT their order?
I might suggest these:
http://drewgourley.com/order-up-custom-ordering-for-wordpress/
you can filter about taxonomie
use this hooks
I would look at the menu generator admin screens. Since a menu is just a custom post type, i’m sure some of that stuff can be used as inspiration..
In order o have a truly arbitrary sorting order (completely unrelated to any post field), you’d need to create a “sort value” (or “weight”) field and enter a numeric value for each item in that field. You can then sort on that field.
If all you want to do is set a position for each “Shirt”, then why not just user the Menu Order, then you can sort by menu_order in your WP_Query. You will probably have to make a meta box which sets the post’s
menu_order
property. Then in yourWP_Query
:$shirts = new WP_Query( 'post_type=shirt&orderby=menu_order&order=ASC' );
This would work similar to how you order images in the
Media Upload
Gallery tab, for set Page’s Menu Order.Or am I misunderstanding something?
What I prefer to do if I’m creating the post type in a plugin or in code is to also add this code, which allows you to set a default order for the front and back-end and also set the GET variable in admin so that the WordPress admin recognizes the change and puts the arrow up if you’re sorting by title, date, or anything else you are showing in the admin table.
Since menu_order is the default this is not needed if you’re sorting a custom post type by menu_order but if it is a post type where you don’t want the user to have to worry about sorting themselves and you want to use something like title, it’s very handy.