I have the following problem. I am trying to create a real estate website with wordpress. I have created a custom post type and I included the following fields with Advanced custom fields: Listing type (select: For sale, For rent), Property type (select: Apartment, House), Price (Number), City (field type: select)
I have the following query to get the values:
<?php
$args = array(
'post_type' => 'properties',
'posts_per_page' => 10,
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'property_type',
'value' => 'Apartment',
),
),
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>
<?php
$property_type = get_field('property_type');
$property_price = get_field('price');
$property_location = get_field('location');
$property_description = get_field('description');
?>
<div class="propert_list">
<h1><?php the_title(); ?></h1>
<div class="property_type">
Location - <strong><?php echo $property_type; ?></strong>
</div>
<div class="property_price">
Price - <strong><?php echo $property_price; ?></strong>
</div>
<div class="property_location">
Location - <strong><?php echo $property_location['address']; ?></strong>
</div>
<div class="property_description">
Property Description - <strong><?php echo $property_description; ?></strong>
</div>
</div>
<br /><hr />
<?php endwhile; ?>
Where and how can I create my search form to filter properties by 'property_type' and 'location'.