ID, 'portfolio_cat', array('fields' => 'ids') );
// arguments
$args = array(
'post_type' => 'ot_portfolio',
'post_status' => 'publish',
'posts_per_page' => 3, // you may edit this number
'ignore_sticky_posts' => 1,
'orderby' => 'rand',
'tax_query' => array(
array(
'taxonomy' => 'portfolio_cat',
'field' => 'id',
'terms' => $custom_taxterms
)
),
'post__not_in' => array ($post->ID),
);
$second_query = new WP_Query( $args );
//Loop through posts and display...
if($second_query->have_posts()) : while ($second_query->have_posts() ) : $second_query->the_post();
/*
* Include the Post-Type-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_type() );
endwhile; wp_reset_query(); endif;
?>