получается, что я хочу заказать мета-значение, называемое «цена», которое рядом с другими, как «описание» и т. Д. Каждое со своим значением.Я попытался отсортировать его с помощью "meta_value_num", но он не упорядочен правильно.
Вот выдержка из моего кода.
$sc = shortcode_atts(array('nopaging' = false, 'post_type' = 'tarifa', 'query' = '', 'registers' = '',
'category' = '', 'tag_name' = '', 'customprice' = 'tarifas', 'price' = '',
'power' = '', 'relation_operator' = '', 'meta_key' = 'tarifas',
'orderby' = 'meta_value_num', 'order' = 'DESC',), $atts);
$options = array('meta_key' = $sc['meta_key'], 'order_by' = $sc['orderby'], 'order' = $sc['order'],
'category_name' = $sc['category'], 'post_type' = $sc['post_type'], 'posts_per_page' = $sc['registers'],);
if ($sc['price'] == '' and $sc['power'] == '') {
$options['meta_query'] = array('relation' = 'AND', array('relation' = 'OR', array('key' = $sc['customprice'], 'value' = $sc['price'],
'compare' => 'LIKE',), array('key' = $sc['customprice'], 'value' = $sc['power'], 'compare' = 'LIKE',),));
$sc['power'] = "default";
$sc['price'] = "default";
} else {
$options['meta_query'] = array('relation' = 'AND', array('relation' = 'OR', array('key' = $sc['customprice'], 'value' = sprintf(':"%s";',
$sc['price']), 'compare' = 'LIKE',), array('key' = $sc['customprice'], 'value' = sprintf(':"%s";',
$sc['power']), 'compare' = 'LIKE',),));
}
$your_loop = new WP_Query($options);