Created
May 26, 2015 07:54
-
-
Save jandrodev/d6073c8922ff3915588e to your computer and use it in GitHub Desktop.
Wordpress Basic Query With tax_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 | |
$args = array( | |
'post_type' => 'page', | |
'posts_per_page' => '3', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'localizacion', | |
'field' => 'slug', | |
'terms' => 'home' | |
) | |
) | |
); | |
$query = new WP_Query( $args ); | |
if(have_posts()) : while($query->have_posts()) : $query->the_post(); ?> | |
<p><?php the_content(); ?></p> | |
<?php endwhile; else : ?> | |
<p class="no-posts"><?php _e('Lo siento, no hay entradas que se ajusten a lo que busca', 'ejemplo'); ?></p> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment