Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to show the range of my houses as per size. Ranges will be:

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); ?>&hellip;</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'
    );  

Note: If I use the query below, then it works, but not for between.

// check size custom fields

if($search_get['size'])
    $meta_query_size = array(
            'key' => '_size',
            'value' => $search_get['size'],
            'compare' => '<=',
            'type' => 'NUMERIC'
        );  

Please advise.

share|improve this question
add comment

1 Answer

Perhaps something wrong with your incoming variable? try without $variable. simply with already setted value and check results.

  'value' => array(100,10000)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.