Files
homeproz/wp-content/themes/homeproz/single-property.php
T
Hanson.xyz Dev cbeca7c6d8 UI/UX improvements: gallery autoplay, clickable cards, footer legal section
Property details page:
- Move address to header above gallery
- Add property type badges (blue residential, red commercial)
- Gallery autoplay with play/pause button, 5-second interval
- Fade transitions for autoplay, slide transitions for swipe
- Thumbnail navigation with sync
- Swipe support in gallery and lightbox
- Widget titles: 18px Times New Roman bold
- Remove breadcrumbs

Layout and styling:
- Container width: 1400px
- Contact page map 50% taller (375px)
- Contact info labels: Times New Roman 16px
- Agent photo backgrounds solid black
- CTA accent button hover: black text

Clickable components:
- Service cards fully clickable with stretched links
- Resource cards fully clickable with stretched links
- Addresses link to Google Maps (contact page, footer)

Footer updates:
- Add Send Us a Message link with paper airplane icon
- Replace credentials with legal section
- Privacy Policy, Fair Housing, MLS Disclaimer, Brokerage Disclosure links
- Credits: Web Design by HansonXyz

Other:
- Install Classic Editor plugin

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 00:24:34 -06:00

269 lines
14 KiB
PHP
Executable File

<?php
/**
* Single Property Template
*
* @package HomeProz
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
get_header();
while (have_posts()) :
the_post();
$property_id = get_the_ID();
// Get property data
$price = get_field('property_price', $property_id);
$street_address = get_field('street_address', $property_id);
$city = get_field('city', $property_id);
$state = get_field('state', $property_id);
$zip_code = get_field('zip_code', $property_id);
$mls_number = get_field('mls_number', $property_id);
$bedrooms = get_field('bedrooms', $property_id);
$bathrooms = get_field('bathrooms', $property_id);
$square_feet = get_field('square_feet', $property_id);
$lot_size = get_field('lot_size', $property_id);
$year_built = get_field('year_built', $property_id);
$garage = get_field('garage', $property_id);
$short_description = get_field('short_description', $property_id);
$property_features = get_field('property_features', $property_id);
$gallery = get_field('property_gallery', $property_id);
$listing_agent = get_field('listing_agent', $property_id);
$property_documents = get_field('property_documents', $property_id);
// Get status from taxonomy
$status_terms = get_the_terms($property_id, 'property_status');
$status = $status_terms && !is_wp_error($status_terms) ? $status_terms[0]->name : '';
$status_class = homeproz_get_status_class($status);
// Get type from taxonomy
$type_terms = get_the_terms($property_id, 'property_type');
$type = $type_terms && !is_wp_error($type_terms) ? $type_terms[0]->name : '';
// Format full address
$full_address = $street_address;
if ($city) $full_address .= ', ' . $city;
if ($state) $full_address .= ', ' . $state;
if ($zip_code) $full_address .= ' ' . $zip_code;
?>
<main id="primary" class="site-main single-property-main">
<div class="container">
<!-- Property Address Header -->
<header class="property-address-header">
<h1 class="property-address-title"><?php echo esc_html($full_address ?: get_the_title()); ?></h1>
</header>
<div class="single-property-layout">
<!-- Main Content -->
<div class="single-property-content">
<!-- Gallery -->
<?php get_template_part('template-parts/property/property-gallery', null, array('gallery' => $gallery, 'property_id' => $property_id)); ?>
<!-- Property Specs -->
<?php if ($bedrooms || $bathrooms || $square_feet || $lot_size || $year_built || $garage) : ?>
<section class="property-specs-section">
<h2 class="section-title">Property Details</h2>
<ul class="property-specs-grid">
<?php if ($bedrooms) : ?>
<li class="spec-item">
<span class="spec-label">Bedrooms</span>
<span class="spec-value"><?php echo esc_html($bedrooms); ?></span>
</li>
<?php endif; ?>
<?php if ($bathrooms) : ?>
<li class="spec-item">
<span class="spec-label">Bathrooms</span>
<span class="spec-value"><?php echo esc_html($bathrooms); ?></span>
</li>
<?php endif; ?>
<?php if ($square_feet) : ?>
<li class="spec-item">
<span class="spec-label">Square Feet</span>
<span class="spec-value"><?php echo esc_html(number_format($square_feet)); ?></span>
</li>
<?php endif; ?>
<?php if ($lot_size) : ?>
<li class="spec-item">
<span class="spec-label">Lot Size</span>
<span class="spec-value"><?php echo esc_html($lot_size); ?></span>
</li>
<?php endif; ?>
<?php if ($year_built) : ?>
<li class="spec-item">
<span class="spec-label">Year Built</span>
<span class="spec-value"><?php echo esc_html($year_built); ?></span>
</li>
<?php endif; ?>
<?php if ($garage) : ?>
<li class="spec-item">
<span class="spec-label">Garage</span>
<span class="spec-value"><?php echo esc_html($garage); ?> Car</span>
</li>
<?php endif; ?>
</ul>
</section>
<?php endif; ?>
<!-- Documents -->
<?php if ($property_documents && is_array($property_documents)) : ?>
<section class="property-documents">
<ul class="documents-list">
<?php foreach ($property_documents as $doc) :
if (!$doc['file']) continue;
$file = $doc['file'];
$label = $doc['label'] ?: $file['filename'];
$ext = pathinfo($file['filename'], PATHINFO_EXTENSION);
?>
<li class="document-item">
<a href="<?php echo esc_url($file['url']); ?>" class="document-link btn btn-secondary" target="_blank" download>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
<line x1="12" y1="18" x2="12" y2="12"/>
<polyline points="9 15 12 18 15 15"/>
</svg>
<?php echo esc_html($label); ?>
<span class="document-ext">(<?php echo esc_html(strtoupper($ext)); ?>)</span>
</a>
</li>
<?php endforeach; ?>
</ul>
</section>
<?php endif; ?>
<!-- Description -->
<section class="property-description">
<h2 class="section-title">Description</h2>
<?php if ($short_description) : ?>
<p class="property-short-desc"><?php echo esc_html($short_description); ?></p>
<?php endif; ?>
<div class="property-full-desc">
<?php the_content(); ?>
</div>
</section>
<!-- Features -->
<?php if ($property_features && is_array($property_features)) : ?>
<section class="property-features">
<h2 class="section-title">Features & Amenities</h2>
<ul class="features-list">
<?php
$feature_labels = array(
'central_air' => 'Central Air',
'central_heat' => 'Central Heat',
'fireplace' => 'Fireplace',
'hardwood_floors' => 'Hardwood Floors',
'updated_kitchen' => 'Updated Kitchen',
'updated_bathrooms' => 'Updated Bathrooms',
'basement' => 'Basement',
'finished_basement' => 'Finished Basement',
'deck_patio' => 'Deck/Patio',
'pool' => 'Pool',
'fenced_yard' => 'Fenced Yard',
'sprinkler_system' => 'Sprinkler System',
'smart_home' => 'Smart Home Features',
'solar_panels' => 'Solar Panels',
'new_roof' => 'New Roof',
'new_windows' => 'New Windows',
'waterfront' => 'Waterfront',
'lake_access' => 'Lake Access',
);
foreach ($property_features as $feature) :
$label = isset($feature_labels[$feature]) ? $feature_labels[$feature] : ucwords(str_replace('_', ' ', $feature));
?>
<li class="feature-item">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" aria-hidden="true">
<polyline points="20 6 9 17 4 12"/>
</svg>
<?php echo esc_html($label); ?>
</li>
<?php endforeach; ?>
</ul>
</section>
<?php endif; ?>
</div>
<!-- Sidebar -->
<aside class="single-property-sidebar">
<!-- Property Header -->
<div class="sidebar-widget property-header-widget">
<div class="property-header-top">
<?php if ($type) : ?>
<?php
$type_slug = sanitize_title($type);
$type_class = 'badge-type-' . $type_slug;
?>
<span class="badge <?php echo esc_attr($type_class); ?>"><?php echo esc_html($type); ?></span>
<?php endif; ?>
<?php if ($status) : ?>
<span class="badge <?php echo esc_attr($status_class); ?>"><?php echo esc_html($status); ?></span>
<?php endif; ?>
</div>
<div class="property-title"><?php echo esc_html(homeproz_format_price($price)); ?></div>
<?php if ($mls_number) : ?>
<p class="property-mls">MLS# <?php echo esc_html($mls_number); ?></p>
<?php endif; ?>
</div>
<!-- Property Documents -->
<div class="sidebar-widget property-documents-widget">
<h3 class="widget-title">Property Documents (SAMPLE)</h3>
<?php if ($property_documents && is_array($property_documents) && !empty($property_documents)) : ?>
<div class="sidebar-documents-list">
<?php foreach ($property_documents as $doc) :
if (!$doc['file']) continue;
$file = $doc['file'];
$label = $doc['label'] ?: $file['filename'];
$ext = strtoupper(pathinfo($file['filename'], PATHINFO_EXTENSION));
?>
<a href="<?php echo esc_url($file['url']); ?>" class="document-btn" target="_blank">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
</svg>
<span class="document-btn-label"><?php echo esc_html($label); ?></span>
<span class="document-btn-ext"><?php echo esc_html($ext); ?></span>
</a>
<?php endforeach; ?>
</div>
<?php else : ?>
<!-- Mock documents for display -->
<div class="sidebar-documents-list">
<a href="#" class="document-btn" onclick="return false;">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
</svg>
<span class="document-btn-label">Property Disclosure</span>
<span class="document-btn-ext">PDF</span>
</a>
<a href="#" class="document-btn" onclick="return false;">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
</svg>
<span class="document-btn-label">Floor Plan</span>
<span class="document-btn-ext">PDF</span>
</a>
</div>
<?php endif; ?>
</div>
<!-- Contact Agent -->
<?php get_template_part('template-parts/property/property-agent', null, array('agent' => $listing_agent, 'property_id' => $property_id)); ?>
</aside>
</div>
</div>
</main>
<?php
endwhile;
get_footer();