Opal-Estate-Pro/templates/single-property/nearby.php

54 lines
1.7 KiB
PHP
Raw Normal View History

2019-09-10 06:27:33 +02:00
<?php
global $property;
2019-10-03 05:13:19 +02:00
if ( 'on' !== $property->get_block_setting( 'nearby' ) ) {
2019-09-10 06:27:33 +02:00
return;
}
if ( ! Opalestate_Yelp::get_client_id() || ! Opalestate_Yelp::get_app_key() ) {
return;
}
$categories = Opalestate_Yelp::get_categories();
if ( ! $categories ) {
return;
}
$map = $property->get_map();
$latitude = $map['latitude'];
$longitude = $map['longitude'];
if ( ! $latitude || ! $longitude ) {
return;
}
?>
<div class="opalestate-box-content property-nearby-session">
<h4 class="outbox-title" id="block-nearby"><?php esc_html_e( 'What\'s nearby', 'opalestate-pro' ); ?></h4>
<div class="opalestate-box">
<div class="box-info">
<div id="opalestate-yelp" class="loading"></div>
<script>
jQuery( document ).ready( function () {
function opalestate_load_yelp_places( property_id ) {
jQuery.ajax( {
type: 'POST',
dataType: 'json',
url: opalesateJS.ajaxurl,
data: 'action=opalestate_load_yelp_places&property_id=' + property_id,
success: function ( response ) {
jQuery( '#opalestate-yelp' ).removeClass( 'loading' ).html( response.result );
jQuery( '#opalestate-yelp' ).html( response.result );
},
error: function ( response ) {
}
} );
}
opalestate_load_yelp_places(<?php echo absint( $property->get_id() ); ?>);
} );
</script>
</div>
</div>
2019-10-03 05:13:19 +02:00
</div>