admin管理员组文章数量:1287490
I am trying to figure out sorting posts with prices in one meta query, so the posts without prices are shown last, when ordered by ASC and not first.
Right now I am temporarily not showing posts without prices but it can't be left like that.
$args = array(
'post_type' => 'inwestycja',
'post_status' => 'publish',
'meta_key' => 'price',
'meta_type' => 'NUMERIC',
'orderby' => 'meta_value_num',
'meta_value' => 1,
'meta_compare' => '>',
'order' => 'ASC',
'tax_query' => array(
array (
'taxonomy' => 'inwestycje',
'field' => 'id',
'terms' => $tax->term_id,
)
),
'posts_per_page' => 24,
'paged' => $paged,
);
Any suggestion how to approach such a problem, without extra work on front end. Extra switches for empty posts with empty prices and so on. Automatic solution :)
Problem is that ASC sorts posts with no price as cheapest, so they are first :)
本文标签: wp queryOrder (by ASC) posts with metakey so posts without values are last
版权声明:本文标题:wp query - Order (by ASC) posts with meta_key so posts without values are last 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741295720a2370804.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论