Документация: https://www.advancedcustomfields.com/resources/
Русская документация: acf.wp-book.ru/category/documentation
<?php
$buildings = get_posts( $args );
foreach( $buildings as $post ){ setup_postdata($post);
?>
<div class="col-lg-12 col-md-12 col-sm-4 col-xs-6">
<div class="card" style="width: 100%;">
<img class="card-img-top" src="<?php $image_url = wp_get_attachment_image_src( $post->photo ); echo $image_url[0] ?>" alt="Card image cap">
<div class="card-body">
<h5 class="card-title"><?php echo $post->price; ?> ₽</h5>
<p class="card-text card-text--build">
<?php
if ($post->room == 'Студия') {
echo ($post->room . ', ' . $post->space . ' м<sup>2</sup>');
}else{
echo ($post->room . ' комн. кв. ' . $post->space . ' м<sup>2</sup>');
}
?><br>
<?php echo ($post->district . '<br>ул. ' . $post->city . ', дом ' . $post->house); ?>
</p>
<a href="<?php the_permalink(); ?>" class="btn btn-primary" target="_blank">Перейти</a>
<?php
echo ($post->meta_query);
?>
</div>
</div>
</div>
<?php
the_post();
}
wp_reset_postdata();
?>
get_posts();
на основе полученных данных с пользовательских полей???$args = array(
'post_type' => 'product',
'meta_query' => array(
array(
'key' => 'color',
'value' => 'blue',
'compare' => 'NOT LIKE'
)
)
);
$query = new WP_Query( $args );
$min_price = "1";
$max_price = "99000";
if(isset($_POST['min_price'])) $min_price = $_POST['min_price'];
if(isset($_POST['max_price'])) $max_price = $_POST['max_price'];
echo "Ваш min_price: $min_price <br> Ваш max_price: $max_price <br><br>";
<form action="" method="post" >
<div class="left">
<label>
от <input name="min_price" type="number" value="<?php echo $min_price?>">
</label>
<div class="minus">
<img src="<?php bloginfo('template_directory')?>/accets/img/minus.png" alt="">
</div>
<label>
до <input name="max_price" type="number" value="<?php echo $max_price?>">
</label>
</div>
<button>го</button>
</form>
<?php
$query = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 6,
'meta_query' => array(
'max_price' => array(
'key' => 'цена',
'value' => $max_price,
'type' => 'NUMERIC',
'compare' => '<=',
),
'min_price' => array(
'key' => 'цена',
'value' => $min_price,
'type' => 'NUMERIC',
'compare' => '>=',
),
),
'orderby' => 'max_price,min_price,minimal_price',
) );
?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<?php
get_template_part( 'loop/item_type1', 'loop' );
?>
<?php endwhile; ?>
<?php
wp_reset_query();
?>