Skip to content

Instantly share code, notes, and snippets.

@leocaseiro
Created May 28, 2014 17:38
Show Gist options
  • Save leocaseiro/98278722e20af4f37d9b to your computer and use it in GitHub Desktop.
Save leocaseiro/98278722e20af4f37d9b to your computer and use it in GitHub Desktop.
<?php
$params = array('post_type' => 'garimpeiros', 'paged' => $paged);
if (isset($wp_query->query_vars['estado']) && '' != $wp_query->query_vars['estado'] ) :
$params['meta_query'] = array(
array(
'key' => 'estado',
'compare' => '=',
'value' => $wp_query->query_vars['estado'],
)
);
endif;
$garimpeiras = new WP_Query($params);
?>
<ul>
<?php if ( $garimpeiras->have_posts() ) : while ( $garimpeiras->have_posts() ) : $garimpeiras->the_post(); ?>
<li><?php the_title(); ?></li>
<?php endwhile; else: ?>
<li><?php _e('Sorry, no posts matched your criteria.'); ?></li>
<?php endif; ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment