if( $query->have_posts('projects') ) :
while( $query->have_posts() ): $query->the_post();
echo '
<article class="col project-card">
<div class="project-outer">
<div class="project-image">
' . get_the_post_thumbnail( get_the_ID(), "project-thumbnail" ); . '
</div>
<div class="project-text">
<h3>' . get_the_title(); . '</h3>
<div class="project-info">
<div class="project-square">
<div class="project-info-img">
<img src="wp-content/themes/ecottage v2/img/info.svg" alt="">
</div>
<span>' . get_post_meta(get_the_ID(), '_k_area', true); . ' ?>м²</span>
</div>
<div class="project-square">
<div class="project-info-img">
<img src="wp-content/themes/ecottage v2/img/bed.svg" alt="">
</div>
<span><?php the_field('bed-rooms');?>спальных</span>
</div>
<div class="project-price">
<?php $sale = get_field('project-sale');
if( $sale && in_array('checked', $sale) ) {
?>
<p class="sale"><?php echo get_post_meta(get_the_ID(), '_k_price_max', true); ?>€</p>
<strong>от <?php the_field('project-price-1'); ?>€</strong>
<?php
}else{?>
<strong><?php echo get_post_meta(get_the_ID(), '_k_price_max', true); ?>€</strong>
<?php
}
?>
</div>
</div>
</div>
<a class="project-link" href="' . get_permalink( $query->post->ID ) . '">Подробнее</a>
</div>
</article>';
endwhile;
wp_reset_postdata();
else :
echo 'Записей не найдено';
endif;
die();
}
while( $query->have_posts() ): $query->the_post(); ?>
<article class="col project-card">
<?php echo '<div class="project-image">' . get_the_post_thumbnail( get_the_ID(), "project-thumbnail" ); . '</div>'; ?>
</article>
$content = '';
$content .= '<article class="col project-card">';
$content .= '<div class="project-image">' . get_the_post_thumbnail( get_the_ID(), "project-thumbnail" ); . '</div>';
if ( $sale ) {
$content .= '<p class="sale"></p>';
}
$content .= '</article>';
echo $content;