<?php
global $post;
$query = new WP_Query( [
'post_type' => 'objects',
'posts_per_page' => 100,
'order' => 'ASC',
] );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
?>
<div class="finished-objects__block" >
<?php
$metadata = SCF::get( 'objects_smart' );
$count=0;
foreach ( $metadata as $meta ) {
?>
<a class="finished-objects__image" href="<?php echo wp_get_attachment_image_src($meta['new_objects_smart'], 'full')[0]; ?><?php echo $count; ?>" data-fancybox="images<?php echo $count; ?>">
<img src="<?php echo wp_get_attachment_image_src($meta['new_objects_smart'], 'full')[0]; ?>" data-src="<?php echo wp_get_attachment_image_src($meta['new_objects_smart'], 'full')[0]; ?>">
</a>
<button class="button-form finished-objects__button button-form-primary">Подробнее</button>
<?php $count+=1; ?>
<?php }
?>
</div>
<?php
}
} else {?>
<b class="nothing-found">Проекты не найдены</b>
<?php
}
wp_reset_postdata(); // Сбрасываем $post
?>