I have a site with two CPT’s Projects and Artworks. I use scribu’s posts2posts for connecting a bunch of artworks to each project.
In a single Project view, I want to display all connected artworks. But the artworks should be grouped under headings like ‘Paintings’, ‘Videos’, etc..
Now, the obvious thing I thought, would be to add a custom taxonomy (work-type) with the terms Paintings’, ‘Videos’ in order to be able to GROUP the artworks by work type.
Using WP_Query(), I can’t order by the terms of my taxonomy.
I can query all the connected works, and do some php stuff, to get them sorted out of course, but I’d like to avoid extra calls to the DB, and to use the WP API as much as possible..
What would be an most effective way of achieving what I need? Do I have to construct a custom raw sql query?