Show one item per category of a custom post type
$args = array( ‘taxonomy’ => ‘portfolio_type’, ‘exclude’ => ‘28,30’, ); $tax = get_terms($args); foreach($tax as $t){ echo ‘<div class=”span3 produto-lista”>’; $args = array( ‘tax_query’ => array( array( ‘taxonomy’ => ‘portfolio_type’, ‘field’ => ‘slug’, ‘terms’ => array($t->slug) ) ), ‘posts_per_page’ => 1, ‘post_status’ => ‘publish’, ‘order’ => ‘DESC’, ); $query = new WP_Query( $args ); while … Read more