fd0693e526
Completed tasks: - html-7jz: Added Communities section with landing page and community template - html-t8u: Added Resources section with Buyer's Guide and Seller's Guide - html-3nq: Enhanced footer with office hours, professional logos, license info New files: - page-communities.php: Communities landing page listing all locations - template-community.php: Individual community page template - page-resources.php: Resources hub with featured guides - template-resource.php: Individual resource/guide page template - content-communities.scss, content-resources.scss: Styles for new pages WordPress changes: - Created Communities page with 3 child pages (Albert Lea, Austin, Glenville) - Created Resources page with 2 child pages (Buyer's Guide, Seller's Guide) - Added Communities and Resources to primary navigation menu - Added new location terms for communities Footer enhancements: - Office hours section (4-column grid now) - Professional association logos (REALTOR, Equal Housing) - License number display
111 lines
3.7 KiB
PHP
111 lines
3.7 KiB
PHP
<?php
|
|
/**
|
|
* Template Name: Community Page
|
|
*
|
|
* Template for individual community/location pages
|
|
*
|
|
* @package HomeProz
|
|
*/
|
|
|
|
// Prevent direct access
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
get_header();
|
|
|
|
// Get the community slug from the page slug
|
|
$community_slug = get_post_field('post_name', get_the_ID());
|
|
|
|
// Get properties in this community
|
|
$community_properties = new WP_Query(array(
|
|
'post_type' => 'property',
|
|
'posts_per_page' => 6,
|
|
'tax_query' => array(
|
|
array(
|
|
'taxonomy' => 'property_location',
|
|
'field' => 'slug',
|
|
'terms' => $community_slug,
|
|
),
|
|
),
|
|
'orderby' => 'date',
|
|
'order' => 'DESC',
|
|
));
|
|
|
|
// Get the location term for additional info
|
|
$location_term = get_term_by('slug', $community_slug, 'property_location');
|
|
?>
|
|
|
|
<main id="primary" class="site-main community-page-main">
|
|
|
|
<?php
|
|
// Hero Section
|
|
$featured_image = get_the_post_thumbnail_url(get_the_ID(), 'full');
|
|
get_template_part('template-parts/components/hero-section', null, array(
|
|
'title' => get_the_title(),
|
|
'subtitle' => 'Discover homes and properties in ' . get_the_title() . ', Minnesota',
|
|
'background_image' => $featured_image,
|
|
'size' => 'small',
|
|
));
|
|
?>
|
|
|
|
<!-- Community Description Section -->
|
|
<section class="community-about-section">
|
|
<div class="container">
|
|
<div class="community-about-content">
|
|
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
|
<?php the_content(); ?>
|
|
<?php endwhile; endif; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Properties in This Community -->
|
|
<section class="community-properties-section">
|
|
<div class="container">
|
|
<header class="section-header">
|
|
<h2 class="section-title">Properties in <?php the_title(); ?></h2>
|
|
<p class="section-subtitle">Browse available homes and land in this area</p>
|
|
</header>
|
|
|
|
<?php if ($community_properties->have_posts()) : ?>
|
|
<div class="property-grid property-grid--3col">
|
|
<?php
|
|
while ($community_properties->have_posts()) :
|
|
$community_properties->the_post();
|
|
get_template_part('template-parts/property/property-card');
|
|
endwhile;
|
|
wp_reset_postdata();
|
|
?>
|
|
</div>
|
|
|
|
<div class="section-footer">
|
|
<a href="<?php echo esc_url(home_url('/properties/?location=' . $community_slug)); ?>" class="btn btn-secondary">
|
|
View All Properties in <?php the_title(); ?>
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
<path d="M5 12h14M12 5l7 7-7 7"/>
|
|
</svg>
|
|
</a>
|
|
</div>
|
|
<?php else : ?>
|
|
<p class="no-properties-message">No properties currently available in <?php the_title(); ?>. Please check back soon or <a href="<?php echo esc_url(home_url('/contact/')); ?>">contact us</a> for assistance.</p>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|
|
|
|
<?php
|
|
// Contact CTA Section
|
|
get_template_part('template-parts/components/cta-section', null, array(
|
|
'title' => 'Looking for a Home in ' . get_the_title() . '?',
|
|
'text' => 'Our local experts know this community inside and out. Let us help you find the perfect property.',
|
|
'button_text' => 'Contact Us Today',
|
|
'button_url' => home_url('/contact/'),
|
|
'style' => 'accent',
|
|
));
|
|
?>
|
|
|
|
</main>
|
|
|
|
<?php
|
|
get_footer();
|