[resolved] Sort by custom field is a little crazy here (3 posts)

  1. Rômulo Zoch
    Posted 2 years ago #

    Hello again, community.
    Well, i'm sorting a loop by a custom field using the args

    posts_per_page' => 0,
        'meta_key' => 'wpcf-imovel-preco' ,
        'orderby' => 'meta_value',

    it works... at some point! then it looses the order and starts again
    like this:
    1) 120.000,00 2) 121.000,00 3) 130.000,00 4) 35.000,00 5) 36.000,00 and so on...
    Well, maybe it has something to do with the , that we use to separate cents and . to thousands.... i know that in english you should write 35,000.00 not 35.000,00, but in brazil we use the second way...
    anyone, please, give me some light on this! :)

  2. Rômulo Zoch
    Posted 2 years ago #

    oh, did I mention that the custom field is a text field created with the Types plugin?

  3. Rômulo Zoch
    Posted 2 years ago #

    damn, i feel so stupid! changed orderby => meta_value to meta_value_num and is ok now, sorry!

Topic Closed

This topic has been closed to new replies.

About this Topic