• Resolved haagendazs1

    (@haagendazs1)


    Hi,

    My problem here is a little complicated (at least to me) so please bare with me here πŸ™‚

    So I have posts about books that have 2 custom field keys: Genre and “Number of Pages”

    I’m trying to make a query that allows visitors to sort by “Number of Pages” within a Genre.

    For example, say I have 5 posts:
    1) Horror, 100
    2) SciFi, 200
    3) SciFi, 150
    4) SciFi, 300
    5) Horror, 50

    I want to query it so that it can display a table like so:
    (Visitor clicks on Horror, and sort by Number of Pages)
    Horror 50
    Horror 100

    (Visitor clicks on SciFi, and sort by Number of Pages)
    SciFi 150
    SciFi 200
    SciFi 300

    The problem is that both “Genre” and “Number of Pages” are “meta keys” so how do I select one meta_value (ones from Genre), and sort by another meta_value (ones from Number of Pages)?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to Query this?’ is closed to new replies.