我想通过他们的座位容量搜索餐厅。我将从下拉列表中选择一个数字,我必须在最小和最大座位容量之间显示餐厅。我试过下面的代码。但它总是没有结果。
$_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', ),
)
);