我想按餐厅的座位数搜索餐厅。我将从下拉菜单中选择一个数字,并且我必须显示最小容纳人数和最大容纳人数之间的餐厅。我尝试下面的代码。但是它始终没有显示结果。
$_seating_capacity = $_GET['seating_capacity'] != '' ? $_GET['seating_capacity'] : '';
$_standing_capacity = $_GET['standing_capacity'] != '' ? $_GET['standing_capacity'] : '';
$_neighborhood = $_GET['neighborhood'] != '' ? $_GET['neighborhood'] : '';
// Start the Query
$v_args = array(
'post_type' => 'Dinings', // your CPT
'meta_query' => array(
'relation' => 'AND',
array(
'relation' => 'OR',
array(
'relation' => 'AND',
array( 'key' => 'min_capacity_sit',
'value' => $_seating_capacity,
'compare' => '=>',
'type' => 'NUMERIC',
),
//AND Conditation
array( 'key' => 'max_capacity_sit',
'value' => $_seating_capacity,
'compare' => '<=',
'type' => 'NUMERIC',
)
),
//OR Conditation
array( 'key' => 'max_capacity_stand',
'value' => $_standing_capacity,
'compare' => '<=',
'type' => 'NUMERIC',
)
),
//AND Conditation
array( 'key' => 'neighborhood', 'value' => $_neighborhood, 'compare' => 'Like', ),
)
);
答案 0 :(得分:0)