Implement launch blockers and MLS state filter

- Add MLS state filter for MN/IA only queries
- Add property inquiry form auto-population with read-only display
- Update broker info and office hours in footer
- Remove Bridge Realty text from about page
- Update service area to Minnesota and Iowa
- Add HomeProz listing identification (is_homeproz column)
- Add dynamic featured listings on front page
- Add gallery thumbnail preloading and loading spinners
- Update FEATURES_PENDING with completion status

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Hanson.xyz Dev
2025-12-16 13:07:12 -06:00
parent 15449b9131
commit 07a8d1756e
21 changed files with 680 additions and 91 deletions
@@ -23,6 +23,23 @@ class MLS_Query {
$this->db = $db;
}
/**
* Get the state filter SQL clause
* Restricts results to MN and IA only
*
* @return string SQL clause
*/
private function get_state_filter() {
if (!defined('MLS_ALLOWED_STATES') || empty(MLS_ALLOWED_STATES)) {
return '';
}
$states = array_map(function($s) {
global $wpdb;
return $wpdb->prepare('%s', $s);
}, MLS_ALLOWED_STATES);
return 'state_or_province IN (' . implode(',', $states) . ')';
}
/**
* Get properties matching criteria
*
@@ -79,6 +96,12 @@ class MLS_Query {
$where = array('mlg_can_view = 1');
$values = array();
// Add state filter (MN and IA only)
$state_filter = $this->get_state_filter();
if ($state_filter) {
$where[] = $state_filter;
}
if ($args['status']) {
$where[] = 'standard_status = %s';
$values[] = $args['status'];
@@ -305,18 +328,20 @@ class MLS_Query {
global $wpdb;
$table = $this->db->properties_table();
$state_filter = $this->get_state_filter();
$state_clause = $state_filter ? " AND {$state_filter}" : '';
if ($status) {
$cities = $wpdb->get_col($wpdb->prepare(
"SELECT DISTINCT city FROM {$table}
WHERE mlg_can_view = 1 AND standard_status = %s AND city IS NOT NULL
WHERE mlg_can_view = 1 AND standard_status = %s AND city IS NOT NULL{$state_clause}
ORDER BY city ASC",
$status
));
} else {
$cities = $wpdb->get_col(
"SELECT DISTINCT city FROM {$table}
WHERE mlg_can_view = 1 AND city IS NOT NULL
WHERE mlg_can_view = 1 AND city IS NOT NULL{$state_clause}
ORDER BY city ASC"
);
}
@@ -334,18 +359,20 @@ class MLS_Query {
global $wpdb;
$table = $this->db->properties_table();
$state_filter = $this->get_state_filter();
$state_clause = $state_filter ? " AND {$state_filter}" : '';
if ($status) {
$counties = $wpdb->get_col($wpdb->prepare(
"SELECT DISTINCT county FROM {$table}
WHERE mlg_can_view = 1 AND standard_status = %s AND county IS NOT NULL
WHERE mlg_can_view = 1 AND standard_status = %s AND county IS NOT NULL{$state_clause}
ORDER BY county ASC",
$status
));
} else {
$counties = $wpdb->get_col(
"SELECT DISTINCT county FROM {$table}
WHERE mlg_can_view = 1 AND county IS NOT NULL
WHERE mlg_can_view = 1 AND county IS NOT NULL{$state_clause}
ORDER BY county ASC"
);
}
@@ -367,6 +394,12 @@ class MLS_Query {
$where = array('mlg_can_view = 1');
$values = array();
// Add state filter (MN and IA only)
$state_filter = $this->get_state_filter();
if ($state_filter) {
$where[] = $state_filter;
}
if (!empty($args['status'])) {
$where[] = 'standard_status = %s';
$values[] = $args['status'];
@@ -437,8 +470,11 @@ class MLS_Query {
public function has_data() {
global $wpdb;
$state_filter = $this->get_state_filter();
$state_clause = $state_filter ? " AND {$state_filter}" : '';
$count = $wpdb->get_var(
"SELECT COUNT(*) FROM {$this->db->properties_table()} WHERE mlg_can_view = 1"
"SELECT COUNT(*) FROM {$this->db->properties_table()} WHERE mlg_can_view = 1{$state_clause}"
);
return (int) $count > 0;
@@ -454,12 +490,14 @@ class MLS_Query {
global $wpdb;
$table = $this->db->properties_table();
$state_filter = $this->get_state_filter();
$state_clause = $state_filter ? " AND {$state_filter}" : '';
if ($status) {
return $wpdb->get_results($wpdb->prepare(
"SELECT property_type, COUNT(*) as count
FROM {$table}
WHERE mlg_can_view = 1 AND standard_status = %s AND property_type IS NOT NULL
WHERE mlg_can_view = 1 AND standard_status = %s AND property_type IS NOT NULL{$state_clause}
GROUP BY property_type
ORDER BY count DESC",
$status
@@ -469,7 +507,7 @@ class MLS_Query {
return $wpdb->get_results(
"SELECT property_type, COUNT(*) as count
FROM {$table}
WHERE mlg_can_view = 1 AND property_type IS NOT NULL
WHERE mlg_can_view = 1 AND property_type IS NOT NULL{$state_clause}
GROUP BY property_type
ORDER BY count DESC"
);
@@ -485,12 +523,14 @@ class MLS_Query {
global $wpdb;
$table = $this->db->properties_table();
$state_filter = $this->get_state_filter();
$state_clause = $state_filter ? " AND {$state_filter}" : '';
if ($status) {
return $wpdb->get_row($wpdb->prepare(
"SELECT MIN(list_price) as min_price, MAX(list_price) as max_price
FROM {$table}
WHERE mlg_can_view = 1 AND standard_status = %s AND list_price > 0",
WHERE mlg_can_view = 1 AND standard_status = %s AND list_price > 0{$state_clause}",
$status
));
}
@@ -498,7 +538,7 @@ class MLS_Query {
return $wpdb->get_row(
"SELECT MIN(list_price) as min_price, MAX(list_price) as max_price
FROM {$table}
WHERE mlg_can_view = 1 AND list_price > 0"
WHERE mlg_can_view = 1 AND list_price > 0{$state_clause}"
);
}