07a8d1756e
- 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>
267 lines
14 KiB
PHP
Executable File
267 lines
14 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Template Name: Contact Page
|
|
* Template for displaying the Contact page
|
|
*
|
|
* @package HomeProz
|
|
*/
|
|
|
|
// Prevent direct access
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
get_header();
|
|
|
|
// Get contact info from theme options
|
|
$phone = homeproz_get_option('phone', '507-516-4870');
|
|
$email = homeproz_get_option('email', 'info@homeprozrealestate.com');
|
|
$address = homeproz_get_option('address', '111 E Clark St, Albert Lea, MN 56007');
|
|
|
|
// Check for property inquiry parameter (passed via URL from single property page)
|
|
$property_inquiry = isset($_GET['property']) ? sanitize_text_field(urldecode($_GET['property'])) : '';
|
|
$property_link = isset($_GET['property_url']) ? esc_url(urldecode($_GET['property_url'])) : '';
|
|
?>
|
|
|
|
<main id="primary" class="site-main contact-page-main">
|
|
|
|
<?php
|
|
// Get hero content from ACF (Page Hero fields) or defaults
|
|
$hero_title = get_field('hero_title') ?: 'Get in Touch';
|
|
$hero_subtitle = get_field('hero_subtitle') ?: 'We\'re here to help with all your real estate needs.';
|
|
$hero_bg = get_field('hero_background');
|
|
$has_bg_class = $hero_bg ? 'has-background' : '';
|
|
$bg_style = $hero_bg ? 'style="background-image: url(' . esc_url($hero_bg) . ');"' : '';
|
|
?>
|
|
<!-- Archive Hero -->
|
|
<section class="archive-hero <?php echo esc_attr($has_bg_class); ?>" <?php echo $bg_style; ?>>
|
|
<?php if ($hero_bg) : ?>
|
|
<div class="archive-hero-overlay"></div>
|
|
<?php endif; ?>
|
|
<div class="container">
|
|
<h1 class="archive-hero-title"><?php echo esc_html($hero_title); ?></h1>
|
|
<?php if ($hero_subtitle) : ?>
|
|
<p class="archive-hero-subtitle"><?php echo esc_html($hero_subtitle); ?></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Contact Section -->
|
|
<section class="contact-section">
|
|
<div class="container">
|
|
<div class="contact-grid">
|
|
<!-- Contact Form -->
|
|
<div class="contact-form-wrapper">
|
|
<h2 class="contact-form-title">Send Us a Message</h2>
|
|
|
|
<?php if ($property_inquiry) : ?>
|
|
<div class="property-inquiry-display">
|
|
<div class="property-inquiry-label">Property Inquiry</div>
|
|
<div class="property-inquiry-value">
|
|
<?php if ($property_link) : ?>
|
|
<a href="<?php echo esc_url($property_link); ?>" target="_blank"><?php echo esc_html($property_inquiry); ?></a>
|
|
<?php else : ?>
|
|
<?php echo esc_html($property_inquiry); ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
// Check for Contact Form 7
|
|
if (function_exists('wpcf7_contact_form')) {
|
|
// Try to get the main contact form
|
|
$contact_form = get_page_by_title('Contact Form', OBJECT, 'wpcf7_contact_form');
|
|
if ($contact_form) {
|
|
echo do_shortcode('[contact-form-7 id="' . $contact_form->ID . '" title="Contact Form"]');
|
|
} else {
|
|
// Display a simple contact form shortcode placeholder
|
|
echo '<p class="contact-form-notice">Contact form will be configured here.</p>';
|
|
// Show default form markup as fallback
|
|
?>
|
|
<form class="contact-form" action="" method="post">
|
|
<?php if ($property_inquiry) : ?>
|
|
<input type="hidden" name="property-inquiry" value="<?php echo esc_attr($property_inquiry); ?>">
|
|
<?php endif; ?>
|
|
<div class="form-group">
|
|
<label for="contact-name">Name <span class="required">*</span></label>
|
|
<input type="text" id="contact-name" name="name" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="contact-email">Email <span class="required">*</span></label>
|
|
<input type="email" id="contact-email" name="email" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="contact-phone">Phone</label>
|
|
<input type="tel" id="contact-phone" name="phone">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="contact-message">Message <span class="required">*</span></label>
|
|
<textarea id="contact-message" name="message" rows="5" required></textarea>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">Send Message</button>
|
|
</form>
|
|
<?php
|
|
}
|
|
} else {
|
|
// Contact Form 7 not installed - show placeholder form
|
|
?>
|
|
<form class="contact-form" action="" method="post">
|
|
<?php if ($property_inquiry) : ?>
|
|
<input type="hidden" name="property-inquiry" value="<?php echo esc_attr($property_inquiry); ?>">
|
|
<?php endif; ?>
|
|
<div class="form-group">
|
|
<label for="contact-name">Name <span class="required">*</span></label>
|
|
<input type="text" id="contact-name" name="name" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="contact-email">Email <span class="required">*</span></label>
|
|
<input type="email" id="contact-email" name="email" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="contact-phone">Phone</label>
|
|
<input type="tel" id="contact-phone" name="phone">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="contact-message">Message <span class="required">*</span></label>
|
|
<textarea id="contact-message" name="message" rows="5" required></textarea>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">Send Message</button>
|
|
</form>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<!-- Contact Info -->
|
|
<div class="contact-info-wrapper">
|
|
<h2 class="contact-info-title">Contact Information</h2>
|
|
|
|
<div class="contact-info-list">
|
|
<?php if ($address) : ?>
|
|
<div class="contact-info-item">
|
|
<a href="https://www.google.com/maps/search/?api=1&query=<?php echo urlencode($address); ?>" class="contact-info-icon" target="_blank" rel="noopener" aria-label="View on map">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/>
|
|
<circle cx="12" cy="10" r="3"/>
|
|
</svg>
|
|
</a>
|
|
<div class="contact-info-content">
|
|
<h4 class="contact-info-label">Office Address</h4>
|
|
<p class="contact-info-value">
|
|
<a href="https://www.google.com/maps/search/?api=1&query=<?php echo urlencode($address); ?>" target="_blank" rel="noopener"><?php echo esc_html($address); ?></a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($phone) : ?>
|
|
<div class="contact-info-item">
|
|
<a href="tel:<?php echo esc_attr(preg_replace('/[^0-9]/', '', $phone)); ?>" class="contact-info-icon" aria-label="Call us">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/>
|
|
</svg>
|
|
</a>
|
|
<div class="contact-info-content">
|
|
<h4 class="contact-info-label">Phone</h4>
|
|
<p class="contact-info-value">
|
|
<a href="tel:<?php echo esc_attr(preg_replace('/[^0-9]/', '', $phone)); ?>">
|
|
<?php echo esc_html($phone); ?>
|
|
</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($email) : ?>
|
|
<div class="contact-info-item">
|
|
<a href="mailto:<?php echo esc_attr($email); ?>" class="contact-info-icon" aria-label="Email us">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
<path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/>
|
|
<polyline points="22,6 12,13 2,6"/>
|
|
</svg>
|
|
</a>
|
|
<div class="contact-info-content">
|
|
<h4 class="contact-info-label">Email</h4>
|
|
<p class="contact-info-value">
|
|
<a href="mailto:<?php echo esc_attr($email); ?>">
|
|
<?php echo esc_html($email); ?>
|
|
</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="contact-info-item">
|
|
<div class="contact-info-icon">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
<circle cx="12" cy="12" r="10"/>
|
|
<polyline points="12 6 12 12 16 14"/>
|
|
</svg>
|
|
</div>
|
|
<div class="contact-info-content">
|
|
<h4 class="contact-info-label">Office Hours</h4>
|
|
<p class="contact-info-value">
|
|
Monday - Friday: 9:00 AM - 5:00 PM<br>
|
|
Weekends: By Appointment
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Map -->
|
|
<div class="contact-map">
|
|
<iframe
|
|
src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2871.8244599999997!2d-93.36827!3d43.64829!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x87f5024a6c0d9e7d%3A0x0!2s111%20E%20Clark%20St%2C%20Albert%20Lea%2C%20MN%2056007!5e0!3m2!1sen!2sus!4v1234567890"
|
|
width="100%"
|
|
height="375"
|
|
style="border:0;"
|
|
allowfullscreen=""
|
|
loading="lazy"
|
|
referrerpolicy="no-referrer-when-downgrade"
|
|
title="HomeProz Office Location">
|
|
</iframe>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Additional Content from Page Editor -->
|
|
<?php if (have_posts()) : ?>
|
|
<?php while (have_posts()) : the_post(); ?>
|
|
<?php if (get_the_content()) : ?>
|
|
<section class="contact-additional-content">
|
|
<div class="container">
|
|
<div class="entry-content">
|
|
<?php the_content(); ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php endif; ?>
|
|
<?php endwhile; ?>
|
|
<?php endif; ?>
|
|
|
|
</main>
|
|
|
|
<?php if ($property_inquiry) : ?>
|
|
<script>
|
|
(function($) {
|
|
if (!$('.Contact_Page').length) return;
|
|
|
|
$(document).ready(function() {
|
|
var propertyInquiry = <?php echo json_encode($property_inquiry); ?>;
|
|
|
|
// Populate CF7 hidden field for property inquiry
|
|
var $hiddenField = $('input[name="property-inquiry"]');
|
|
if ($hiddenField.length) {
|
|
$hiddenField.val(propertyInquiry);
|
|
}
|
|
});
|
|
})(jQuery);
|
|
</script>
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
get_footer();
|