Forums

Order By custom type field (2 posts)

  1. alexjamesbrown
    Member
    Posted 4 months ago #

    I have a custom type 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...

  2. alexjamesbrown
    Member
    Posted 4 months ago #

    bump?

Reply

You must log in to post.

About this Topic