function idx_build_filter() {
    $filters = array("StandardStatus eq 'Active'");

    if (!empty($_GET['idx_city'])) {
        $city = str_replace("'", "", sanitize_text_field($_GET['idx_city']));
        $filters[] = "contains(tolower(City), '" . strtolower($city) . "')";
    }
    if (!empty($_GET['idx_type'])) {
        if ($_GET['idx_type'] === 'rent') {
            $filters[] = "contains(PropertyType, 'Lease')";
        } else {
            $filters[] = "not contains(PropertyType, 'Lease')";
        }
    }
    if (!empty($_GET['idx_beds'])) {
        $filters[] = "BedroomsTotal ge " . intval($_GET['idx_beds']);
    }
    if (!empty($_GET['idx_baths'])) {
        $filters[] = "BathroomsTotalInteger ge " . intval($_GET['idx_baths']);
    }
    if (!empty($_GET['idx_min_price'])) {
        $filters[] = "ListPrice ge " . intval($_GET['idx_min_price']);
    }
    if (!empty($_GET['idx_max_price'])) {
        $filters[] = "ListPrice le " . intval($_GET['idx_max_price']);
    }

    return implode(' and ', $filters);
}

function idx_get_listings($top = 21, $skip = 0, $filter = null) {
    if ($filter === null) {
        $filter = idx_build_filter();
    }
    $base = 'https://api.bridgedataoutput.com/api/v2/OData/test/Property';
    $fields = 'ListPrice,BedroomsTotal,BathroomsTotalInteger,City,UnparsedAddress,LivingArea,PropertyType,PropertySubType,ListOfficeName,Media,ListingKey';

    $url = add_query_arg(array(
        'access_token' => '6baca547742c6f96a6ff71b138424f21',
        '$top'         => $top,
        '$skip'        => $skip,
        '$select'      => $fields,
        '$filter'      => $filter,
    ), $base);

    $response = wp_remote_get($url);
    if (is_wp_error($response)) {
        return array('listings' => array(), 'total' => 0);
    }

    $body = wp_remote_retrieve_body($response);
    $data = json_decode($body, true);

    return array(
        'listings' => isset($data['value']) ? $data['value'] : array(),
        'total'    => isset($data['@odata.count']) ? $data['@odata.count'] : 0,
    );
}function idx_listings_shortcode() {
    $per_page = 21;
    $current_page = isset($_GET['idx_page']) ? max(1, intval($_GET['idx_page'])) : 1;
    $skip = ($current_page - 1) * $per_page;

    $result = idx_get_listings($per_page, $skip);
    $listings = $result['listings'];
    $total = $result['total'];
    $total_pages = ceil($total / $per_page);

    ob_start();
    include IDX_PLUGIN_DIR . 'templates/filter-bar.php';
    echo '<div class="idx-results-count">' . number_format($total) . ' results</div>';
    echo '<div class="idx-grid">';
    foreach ($listings as $property) {
        include IDX_PLUGIN_DIR . 'templates/listing-card.php';
    }
    echo '</div>';
    include IDX_PLUGIN_DIR . 'templates/pagination.php';

    return ob_get_clean();
}<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://sono.noulsports.com/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://sono.noulsports.com/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://sono.noulsports.com/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://sono.noulsports.com/wp-sitemap-posts-product-1.xml</loc></sitemap><sitemap><loc>https://sono.noulsports.com/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://sono.noulsports.com/wp-sitemap-taxonomies-product_cat-1.xml</loc></sitemap><sitemap><loc>https://sono.noulsports.com/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
