Created
December 15, 2016 11:47
-
-
Save hemraj7171/3209ad4b9a5a44b242fdae5208fcdab0 to your computer and use it in GitHub Desktop.
Price Different Range Query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function product_price_loop( $priceArray ) { | |
$arr = array( 'relation' => 'OR' ); | |
/*$output['output'] = print_pre($arr); | |
return $output; */ | |
foreach( $priceArray as $key => $value ) { | |
$price_range = explode( '-', $value ); | |
# code... | |
$arr[$key] = array( | |
'key' => '_regular_price', | |
'value' => array( $price_range[0], $price_range[1] ), | |
'compare' => 'BETWEEN', | |
'type' => 'NUMERIC' | |
); | |
} | |
return $arr; | |
} | |
$args['meta_query'] = product_price_loop( $pram['product_price'] ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment