Last active
April 18, 2017 15:21
-
-
Save alandbh/3e4463619c499d9b6174a4fedfebeb3d to your computer and use it in GitHub Desktop.
It get posts by taxomony terms. // Pega posts pela taxonomia
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
function feed_cidades($categoria) { | |
if ($categoria == '') { | |
$args = array ( | |
'post_type' => 'cidades', //it can be other | |
'posts_per_page' => '-1' | |
//'post__not_in' => array($exclude) | |
); | |
} else { | |
$args = array ( | |
'post_type' => 'riquezas', //it can be other | |
'posts_per_page' => '-1', | |
//'post__not_in' => array($exclude), | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'regiao', | |
'field' => 'slug', | |
'terms' => $categoria, | |
), | |
) | |
); | |
} | |
if ($categoria == 'natureza') { | |
$texto = 'Retranca natureza'; | |
} elseif ($categoria == 'pessoas') { | |
$texto = 'Retranca pessoas'; | |
} | |
// The Query | |
$postagens = new WP_Query( $args ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment