| Server IP : 68.183.124.220 / Your IP : 216.73.216.141 Web Server : Apache/2.4.18 (Ubuntu) System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : gavin ( 1000) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/wp-content/plugins/aperture-real-estate-pro/templates/blocks/ |
Upload File : |
<div class="sections property-wrapper clear">
<div class="grid-wide property-preview">
<?php
global $post;
//vars
$title = get_sub_field('section_title');
$type = get_sub_field('property_type');
$property_no = get_sub_field('number_of_properties');
$locations = get_sub_field('location');
//Property Status
if ($type == 'all') {
$status = '';
} elseif($type =='rent') {
$status = 'Rent';
} elseif($type =='sale') {
$status = 'Sale';
} elseif($type =='sold') {
$status = 'Sold';
}
if(!$locations) {
$locations = 'null';
}
//Section header
echo '<h2 class="section-title">'. $title .'</h2>';
$arr = array(
'post_type' => 'property',
'posts_per_page' => $property_no,
'meta_key' => 'status',
'meta_value' => $status,
'tax_query' => array(
array(
'taxonomy' => 'location',
'field' => 'id',
'terms' => array($locations),
),
),
);
$property = new WP_Query( $arr );
if($property->have_posts()):
while($property->have_posts()): $property->the_post();
$status = get_field('status');
$price = number_format(get_field('price'));
$currency = get_field('currency','option');
$rooms = get_field('rooms');
$bedrooms = get_field('bedrooms');
$bathrooms = get_field('bathrooms');
$garage = get_field('garage');
$area = get_field('area');
?>
<div class="col-3-12 property">
<?php if ( has_post_thumbnail() ) {
$thumb = get_the_post_thumbnail_url(get_the_ID(),'large');
}
else {
$thumb = get_template_directory_uri() .'/img/header-default.jpg';
} ?>
<a href="<?php the_permalink(); ?>" >
<div class="thumbnail" style="background-image:url('<?php echo $thumb; ?>'); background-size: cover;">
<?php if($status == 'Rent') {?>
<span class="for-rent"><?php esc_html_e('Rental','aperture-real-estate-pro');?></span>
<?php } elseif($status == "Sale") { ?>
<span class="for-sale"><?php esc_html_e('For Sale','aperture-real-estate-pro');?></span>
<?php } else {?>
<span class="sold"><?php esc_html_e('SOLD','aperture-real-estate-pro');?></span>
<?php } ?>
<span class="aperture-price"><?php echo $currency , $price; ?></span>
</div>
</a>
<div class="property-details">
<?php //aperture_property_location(); ?>
<span class="location"><?php the_terms( $post->ID, 'location' ); ?></span>
<?php
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
?>
<?php
// check if the repeater field has rows of data
//do no re-write this using a while loop it messes up the wp loop to infinity.
//only seems to affect the properties block, too many loops maybe?
$rows = get_field('details');
if($rows){
echo '<div class="property-amenities-small"> <ul class="amenities clear">';
// using array_slice to limit the returned values to 3
$details = array_slice( get_field('details'), 0, 3 );
foreach((array) $details as $detail){
// display a sub field value
echo '<li class="checked">' . $detail["detail"] .'</li>';
}
echo '</ul></div>';
}
?>
</div>
</div>
<?php
endwhile;
wp_reset_postdata();
endif;
?>
</div>
</div>