jpcontrerasv
7/30/2014 - 2:53 PM

WP > Wp_queries

WP > Wp_queries

<?php $var_destacados = new WP_Query('post_type=destacados&showposts=6'); while ($var_destacados->have_posts()) : $var_destacados->the_post(); ?>
         
<?php endwhile; ?>


/*con taxonomias*/
<?php 
query_posts( array(
'post_type' => 'video',
'taxonomy'	=> 'programas',
'term'	=> 'la-escul',
'posts_per_page'	=> 4,
'cat' => '-204'
));
if (have_posts()) :
while (have_posts()) : the_post();  
?>


<?php endwhile; endif;  ?>
<?php wp_reset_query(); ?>



/*Excluir taxonomia del post type */

					<?php 
                    query_posts( array(
                    'post_type' => 'video',
                    'posts_per_page'	=> 4,
                    'cat' => '-204',
					
					'tax_query'	=> array(
						array(
							'taxonomy'  => 'programas',
							'field'     => 'slug',
							'terms'     => 'la-escul', 
							'operator'  => 'NOT IN')
							),
                    ));
                    if (have_posts()) :
                    while (have_posts()) : the_post();  
                    ?>