help me order by custom field (float and str)
-
Hi guys,
Well, i need to order posts by a custom field named wpsc-imovel-preco. it is a string field. The code i have is this:<?php $argsvs = array( 'post_type' => 'imovel-para-venda', 'meta_key' => 'wpcf-imovel-preco', 'posts_per_page' => 0, 'orderby' => 'meta_value meta_value_num', 'order' => 'ASC' ); ?>
The thing is, we use values like: 100.000,00 or 30.000,00 Thats because in brazil we separate thousands by . not by , and decimals by , not by .
well, i’m trying to fix this about a week for now, but it just doesn’t work.If you wanna se what happens, please reffer to https://alanaimoveis.com.br/imovel-para-venda/ it begins with millions, then goes to 100thousand, then works ok ’till 200thousand, and goes back to 30fcknThousand…. please… please.. help me.
I wanned to convert to string before doing orderby, but it doesn’t seem to be supported.
- The topic ‘help me order by custom field (float and str)’ is closed to new replies.