Esempio n. 1
0
$suburb_info = $wpdb->get_row($wpdb->prepare("SELECT * from suburb where suburb_name = %s", $suburb));
if ($suburb_info == null) {
    $errorMessage = array('message' => "Please check the suburb. Couldn't find the provided suburb.");
    wp_send_json_error($errorMessage);
}
$postal_code = $suburb_info->postcode;
// Checks if the query is for full house address
if (isset($_REQUEST['street_number'])) {
    // Send both house details and community details
    $title = getHouseTitle($postal_code);
    $post = get_page_by_title($title, OBJECT, 'house');
    if ($post != null && $post instanceof \WP_Post) {
        // Get both house and community by post id
        $post_id = $post->ID;
        $propertyDetails['success'] = true;
        $propertyDetails['data'] = \titanium\TitaniumCommunityClass::getPropertyDetailsByPostID($post_id);
    } else {
        $propertyDetails['success'] = false;
        $propertyDetails['message'] = "The information about this address <b>" . $title . "</b> is not available.<br/>We will try to get the information as soon as possible, meanwhile you can view the<br/>information related to that suburb. Also please make sure address you search is case sensetive";
    }
}
// Send community details anyway
// Get only community and near by house
$communityDetails['data'] = \titanium\TitaniumCommunityClass::getCommunityDetailsBySuburb($suburb);
//unset($communityDetails['data']['suburb_info']);
$response = array();
//Add property details to response array
if (isset($propertyDetails)) {
    $response['resident'] = $propertyDetails;
}
//Add community details to response array
 * User: vivekbhusal
 * Date: 12/09/15
 * Time: 3:59 PM
 */
$quality_pro_options = theme_data_setup();
$current_options = wp_parse_args(get_option('quality_pro_options', array()), $quality_pro_options);
$args = array('posts_per_page' => 3, 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => 'date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'house', 'post_mime_type' => '', 'post_parent' => '', 'author' => '', 'post_status' => 'publish', 'suppress_filters' => true);
$posts_array = get_posts($args);
?>
<div id="latest">
    <?php 
foreach ($posts_array as $house) {
    ?>
        <?php 
    $permalink = get_post_permalink($house->ID);
    $property = \titanium\TitaniumCommunityClass::getPropertyDetailsByPostID($house->ID);
    ?>
        <div class="col-md-4 col-sm-6 latest-property">
            <a href="<?php 
    echo $permalink;
    ?>
" class="latest-property-item-link">
                <div class="latest-property-info">
                    <span class="latest-property-address"><?php 
    echo $property['address'];
    ?>
</span>
                    <div class="latest-property-row">
                        <?php 
    $airConditionClass = $property['air_conditioner']['has'] == '0' ? 'latest-property-air-conditioner-icon-grey' : 'latest-property-air-conditioner-icon';
    $heaterClass = $property['heater']['has'] == '0' ? 'latest-property-heater-icon-grey' : 'latest-property-heater-icon';