具有相同metakey且具有多个值的元查询

时间:2014-11-11 11:25:16

标签: php search dynamic model narrowing

我希望在2003年至2009年期间显示具有"modelyear between 2003 to 2006 and modelyear between 2007 to 2009 AND price between 1 lakh to 3 lakh and price between 3 lakh to 5 lakh" MEANS记录的记录,以及在jabong.com窄搜索中的价格在10万到5万之间。

我使用了以下内容(见下文)。但它不起作用。

有人建议,如何在 wordpress元查询中解决?请!

<?php 
$args2=array(
'posts_per_page' => 100,
'post_type' => 'product',
'post_status' => 'publish',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'year',
'value' => array(2003, 2006),
'compare' => 'BETWEEN',
//'type' => 'DECIMAL',
),
array(
'key' => 'year',
'value' => array(2007, 2009),
'compare' => 'BETWEEN',
//'type' => 'DECIMAL',
),


array(
'key' => '_price',
'value' => array(1, 3),
'compare' => 'BETWEEN',
//'type' => 'DECIMAL',
),
array(
'key' => '_price',
'value' => array(3, 5),
'compare' => 'BETWEEN',
//'type' => 'DECIMAL',
),

),
);
?>

0 个答案:

没有答案