alessio-d
11/24/2017 - 5:17 PM

Custom loop post type

$args = array(
			    'post_per_page' 	=> '6',
			    'post_type' 		=> 'corsi',
			    'meta_key'			=> 'data_corso',
				'orderby'			=> 'meta_value',
				'order'				=> 'DESC',
			    'tax_query' => array(
			        array(
			            'taxonomy' => 'categoria',
			            'field'    => 'slug',
			            'terms' => $terms
			    	)
				)
			);
			
$corsi = new WP_Query( $args );

if ( $corsi->have_posts() ) {
			while ( $corsi->have_posts() ) {
				$corsi->the_post();
				
			}

		wp_reset_postdata();
}