我想按大小显示我房子的范围。范围为:
1-50
50-100
100-150
150-200
200-250
+250
HTML code
<select name="size" id="search-type" class="text<?php echo $select_wide; ?>">
<option value=""><?php _e(\'Size..\', TS_DOMAIN); ?>…</option>
<option name="size" value="1">1-50 M2</option>
<option name="size" value="5000">50-100 M2</option>
<option name="size" value="10000">100-150 M2</option>
<option name="size" value="15000">150-200 M2</option>
<option name="size" value="20000">200-250 M2</option>
<option name="size" value="999999">+250 M2</option>
</select>
PHP code
// check size custom fields
if($search_get[\'size\'])
$meta_query_size = array(
\'key\' => \'_size\',
\'value\' => array($search_get[\'size\'],10000),
\'compare\' => \'BETWEEN\',
\'type\' => \'NUMERIC\'
);
注意:如果我使用下面的查询,那么它可以工作,但不适用于
between
.
// check size custom fields
if($search_get[\'size\'])
$meta_query_size = array(
\'key\' => \'_size\',
\'value\' => $search_get[\'size\'],
\'compare\' => \'<=\',
\'type\' => \'NUMERIC\'
);
请告知。