I have a custom post type called as
books with taxonomy named as
genre. Inside the
genre there are a number of terms such as
I want to display them in the archive page, grouped by each terms. So I use Chip Bennet's fantastic code.
However, I have problem with the sorting.
The code sorts the terms according to its alphabetical names, and the posts according to the recentness. So it appears like this:
- Newest book
- Not so new book
- Old book
- etc the same: newest - not new - old
Meanwhile, I need it to be sorted differently. I want to sort the terms according to the tag_ID, and the book list according to its alphabetical name. So it should look like this:
(tag_ID number 1)
(tag_ID number 2)
(tag_ID number 3)
(tag_ID number 4)
I tried to mess with the query, so it looks like this
$member_group_query = new WP_Query( array( 'post_type' => 'member', 'orderby ' => 'name', // sort the books alphabetically 'tax_query' => array( array( 'taxonomy' => 'member_group', 'field' => 'slug', 'terms' => array( $member_group_term->slug ), 'orderby ' => 'ID', // sort the genre according to its ID 'operator' => 'IN' ) ) ) );
But nothing changes. I checked Wordpress Codex on
WP_Query to make sure but still no avail. Any help?