Order by meta values

Discussion in 'WordPress' started by secretdesign, Oct 3, 2012.

  1. #1
    I have 3 meta fields related to dates:

    year = 2012
    release_date = 14 November 2012
    release_date_db = 20121114
    I need to show the posts from year 2012 sorted by release_date.

    I made this:

    
    query_posts('meta_key=year&meta_value=2012&order=ASC&posts_per_page=7');
    
    Code (markup):
    How can I order posts by release_date or release_date_db?

    THX
     
    secretdesign, Oct 3, 2012 IP
  2. Devtard

    Devtard Notable Member

    Messages:
    850
    Likes Received:
    133
    Best Answers:
    4
    Trophy Points:
    220
    #2
    Devtard, Oct 3, 2012 IP
  3. secretdesign

    secretdesign Well-Known Member

    Messages:
    797
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    155
    Digital Goods:
    3
  4. Devtard

    Devtard Notable Member

    Messages:
    850
    Likes Received:
    133
    Best Answers:
    4
    Trophy Points:
    220
    #4
    Well, you have to specify also the meta_key parameter, that's why I posted the link to WP Codex. :)
     
    Devtard, Oct 3, 2012 IP
  5. secretdesign

    secretdesign Well-Known Member

    Messages:
    797
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    155
    Digital Goods:
    3
    #5
    Hahaha I did. This is more complicated then simple meta key and value I needed to compare and 2 arrays. ;) , all work now. THX for reply.
     
    secretdesign, Oct 3, 2012 IP