<div class="catalog__items">
<?php
$my_posts = get_posts(array(
'numberposts' => -1,
'category_name' => 'project',
'orderby' => 'date',
'order' => 'DESC',
'include' => array(),
'exclude' => array(),
'meta_key' => '',
'meta_value' => '',
'post_type' => 'post',
'suppress_filters' => true,
));
global $post;
foreach ($my_posts as $post) {
setup_postdata($post);
?>
<div class="catalog__item">
<a href="<?php the_permalink(); ?>" class="catalog__item-link">
<?php
$images = get_field('projects__img');
$first = true;
foreach ($images as $image) {
if ($first) {
?>
<img class="catalog__img" src="<?= $image['sizes']['medium_large'] ?>" alt="<?= $image['id'] ?>">
<?php
$first = false;
}
}
?>
<h3 class="catalog__item-title"><?php the_field('product__title') ?></h3>
</a>
</div>
<?php
}
wp_reset_postdata();
?>
</div>