I have a custom type on a wordpress site I’ve developed.
The type is called called “book”
It has a field called “book_year”
I’ve just added a field called book_month (int 1-12)
The query to retrieve all “books” is currently:
$query .= ‘post_type=books&posts_per_page=’.$perpage.’&paged=’.$paged.’&orderby=meta_value&meta_key=book_year&order=DESC’;
What I want to do is order by book_year, then by book_month (so that January (1) appears before June (6) )
I take it it’s the orderby part that needs changing, I’m just not sure as to what…
Your code should result in building this in the query: