WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Sort by custom field is a little crazy here

[Resolved] Sort by custom field is a little crazy here

  • romuloctba

    @romuloctba

    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',
        'order'=>'ASC'

    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! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • romuloctba

    @romuloctba

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

    romuloctba

    @romuloctba

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Sort by custom field is a little crazy here’ is closed to new replies.
Skip to toolbar