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 ( $query->have_posts() ) {
                            $query->the_post();

                            ?>

                            <a href="https://wordpress.stackexchange.com/questions/227208/<?php echo get_term_link($t); ?>">

                            <?php
                            the_post_thumbnail(); ?>
                            <h1>
                            <?php
                            echo $t->name; 
                            ?>
                            </h1>
                            </a>
                            <?php
                        }
                        wp_reset_query();
                    echo '</div>';
                }