d2321
5/15/2020 - 1:41 PM

Related Singular

<?php 
    $terms_assigned = get_the_terms( $card_id, 'szkolenia_kategorie' ); 
    $card_id = get_the_ID();

    foreach($terms_assigned as $term) {$t_assigned[] = $term->term_id;}

    $args = array(
        'post_type' => 'szkolenia',
        'showposts' => 3,
        'post__not_in' => array(get_the_ID())
    );
    $args['tax_query'] = array(
        array(
            'taxonomy' => 'szkolenia_kategorie',
            'field' => 'term_id', 
            'terms' => $t_assigned,
        )
    );	
    
    $prods = get_posts($args);
    if($prods) :
?>
<div class="container mt-10">
	<div class="text-center">
		<div class="subtitle"><?php the_field('string_zobacz_tez', $curLang); ?></div>
		<div class="heading-4 mb-8"><?php the_field('string_podobne_szkolenia', $curLang); ?></div>
    </div>


		<div class="row">
			<?php foreach($prods as $post) { ?> 
			
				<?php $card_id = $post->ID; ?>
				<div class="col-md-4 col-card-prod">                    
					<?php include (locate_template( 'parts/catalog/card-data-for-item.php' )); //in loop ?>       
					<?php include (locate_template( 'parts/catalog/card-item.php' )); //outputs $render_card_item ?>   
					<?php echo $render_card_item; ?>    
				</div>

			<?php } ?>
		</div>

	
</div>
<?php endif; ?>