Last active
December 3, 2015 13:39
-
-
Save diegoliv/3b43c0e63c8fe77a31f5 to your computer and use it in GitHub Desktop.
WP_Query com múltiplos meta_query
This file contains hidden or 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 | |
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
$roi_min = (get_query_var('roi_min')) ? intval( get_query_var('roi_min') ) : false; | |
$roi_max = (get_query_var('roi_max')) ? intval( get_query_var('roi_max') ) : false; | |
$args = array( | |
'post_type' => 'post', | |
'posts_per_page' => 10, | |
'paged' => $paged, | |
'meta_query' => array( | |
'relation' => 'AND', | |
array( | |
'key' => 'roi_min', | |
'value' => $roi_min, | |
'compare' => '>=', | |
'type' => 'NUMERIC' | |
), | |
array( | |
'key' => 'roi_max', | |
'value' => $roi_max, | |
'compare' => '<=', | |
'type' => 'NUMERIC' | |
) | |
) | |
); | |
$reports = new WP_Query( $args ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment