Question

This is a similar question to Sorting for each custom taxonomy, but I don't feel like it was clearly asked or responded to.

I have a custom post type "player" and a custom taxonomy "player_details". The player details consists of things like Height, Weight, Country, Jersey #, etc. I want to add a custom filter / sorting mechanism to my player archives so that you could sort by height, weight, etc.

The built-in query_posts function allows you to sort by date, title, etc, but I don't see how to sort by taxonomy. I realize that if the taxonomy details, were in custom fields, I could sort it that way, but that defeats the purpose of storing it in a custom taxonomy, which is where it should be stored.

Is there a way to do this that I'm not aware of, or is it going to require some deep hacking into Custom Queries? http://codex.wordpress.org/Custom_Queries

Was it helpful?

Solution

This doesn't seems to be natively possible, even with upcoming improvements in WP 3.1.

[...] That’s not what taxonomies are for. Taxonomies are for grouping, not for ordering by. If you want to order by something, it has to be something in the post itself, not a term in a taxo. Otto

For this kind of data custom fields make much more sense. Instead of "group of people who weight 60kg", it should be "Player A (60kg), Player B (60kg), etc".

Details are by definition individual. Taxonomies are broad generic groups.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top