<?php
$layout = $settings['layout'];
$prod_categories = get_terms( 'product_cat', $catargs );
foreach ( $prod_categories as $key => $prod_cat ):
$counter++;
$bgc++;
$cat_thumb_id = get_term_meta( $prod_cat->term_id, 'thumbnail_id', true );
$cat_thumb = wp_get_attachment_image( $cat_thumb_id, $image_size );
$term_link = get_term_link( $prod_cat, 'product_cat' );
$thumbnails = $cat_thumb;
<div class="<?php echo esc_attr( $collumval ); ?>">
<?php if( '1' === $layout ): ?>
<div class="1"></div>
<?php elseif( '3' === $layout ):?>
<a>ссылка</a>
<?php endif; ?>
</div>
<?php
if( $bgc == 4 ){ $bgc = 0; }
if( $counter == $limitcount ) { break; }
endforeach;
<div class="w-row">
<div class="3">
<a>ссылка</a>
</div>
<div class="3">
<a>ссылка</a>
</div>
</div>
<div class="3"><a href="#">test</a></div>
Есть цикл который выводит блоки со ссылками внутри
<?php
$layout = $settings['layout'];
$prod_categories = get_terms( 'product_cat', $catargs );
foreach ( $prod_categories as $key => $prod_cat ):
$counter++;
$bgc++;
$cat_thumb_id = get_term_meta( $prod_cat->term_id, 'thumbnail_id', true );
$cat_thumb = wp_get_attachment_image( $cat_thumb_id, $image_size );
$term_link = get_term_link( $prod_cat, 'product_cat' );
$thumbnails = $cat_thumb;
?>
<div class="<?php echo esc_attr( $collumval ); ?>">
<?php if( '1' === $layout ): ?>
<div class="1"></div>
<?php elseif( '3' === $layout ):?>
<a>ссылка</a>
<?php endif; ?>
</div>
<?php
if( $bgc == 4 ){ $bgc = 0; }
if( $counter == $limitcount ) { break; }
endforeach;
$layout = $settings['layout'];
$prod_categories = get_terms('product_cat', $catargs);
foreach ($prod_categories as $key => $prod_cat) {
$counter++;
$bgc++;
$cat_thumb_id = get_term_meta($prod_cat->term_id, 'thumbnail_id', true);
$cat_thumb = wp_get_attachment_image($cat_thumb_id, $image_size);
$term_link = get_term_link($prod_cat, 'product_cat');
echo '<div class="' . esc_attr($collumval) . '">';
switch ($layout) {
case '1':
echo '<div class="1"></div>';
break;
case '3':
echo '<a href="' . esc_url($term_link) . '">ссылка</a>';
break;
}
echo '</div>';
if ($bgc == 4) {
$bgc = 0;
}
if ($counter == $limitcount) {
break;
}
}
if ('3' === $layout) {
echo '<div class="3"><a href="#">test</a></div>';
}