Post by taxonomy term
$terms = wp_get_post_terms( $post->ID , 'type' );
if ( $terms != null ){
foreach( $terms as $term ) {
$args = array(
'post_type' => 'portfolio',
'posts_per_page' => '3',
'tax_query' => array (
array (
'taxonomy' => 'type',
'field' => 'slug',
'terms' => $term->slug
)
)
);
}}
$query = new WP_Query($args);
$i = 1;
while ( $query->have_posts() ) : $query->
the_post();