WP Residence Help WP Residence Help

  • WpEstate
  • How to Build Your Website
  • Video Tutorials
  • Client Support
  • API
Home / Technical how to | Custom Code Required, WpResidence 5.0 / WpResidence Developer and Agency List Templates Guide

WpResidence Developer and Agency List Templates Guide

130 views 0

This guide explains the functionality and customization options for the Developer List and Agency List templates in the WpResidence theme. These templates are responsible for displaying lists of developers and agencies in a grid format.

Template Files

  1. Developer List: page-templates/developers_list.php
  2. Agency List: page-templates/agency_list.php

Both templates share similar structures and functionalities, with minor differences specific to developers and agencies.

Template Structure

1. Header and Functionality Check

Both templates start by loading the header and checking for required functionality:

<?php
get_header();
if(!function_exists('wpestate_residence_functionality')) {
esc_html_e('This page requires the WpResidence Core Plugin. Please activate it from the plugins menu.','wpresidence');
exit();
}

The wpestate_residence_functionality function is typically defined in the WpResidence Core Plugin.

2. Page Layout

The templates use a common layout structure:

<div class="row wpresidence_page_content_wrapper">
<?php get_template_part('templates/breadcrumbs'); ?>
<div class="<?php echo esc_attr($wpestate_options['content_class']); ?>">
<?php get_template_part('templates/ajax_container'); ?>
<!-- Page title and content -->
<!-- Listing container -->
</div>
<?php include get_theme_file_path('sidebar.php'); ?>
</div>

The $wpestate_options['content_class'] variable is typically set in the theme’s options panel and controls the width of the main content area.

3. Query Setup

Both templates use WP_Query to fetch and display developers or agencies:

$args = array(
'post_type' => 'estate_developer', // or 'estate_agency' for agency list
'paged' => get_query_var('paged') ? get_query_var('paged') : 1,
'posts_per_page' => 10,
'cache_results' => false
);
$developer_query = new WP_Query($args);

4. Developer/Agency Loop

The templates loop through the query results to display individual developer or agency cards:

while ($developer_query->have_posts()): $developer_query->the_post();
echo '<div class="dev_unit_wrapper">'; // or 'agency_unit_wrap' for agencies
get_template_part('templates/agency__developers_cards_templates/agency_developer_unit');
echo '</div>';
endwhile;

The agency_developer_unit.php template (located in templates/agency__developers_cards_templates/) is responsible for rendering individual developer or agency cards.

5. Pagination

After the loop, both templates display pagination:

<?php wpestate_pagination($developer_query->max_num_pages, $range = 2); ?>

The wpestate_pagination function is typically defined in the theme’s functions file or a separate pagination functions file.

Customization and Extension

1. Modifying Query Arguments

You can customize the query by modifying the $args array. For example, to change the number of items per page:

$args = array(
'post_type' => 'estate_developer',
'paged' => get_query_var('paged') ? get_query_var('paged') : 1,
'posts_per_page' => 12, // Changed from 10 to 12
'cache_results' => false
);

2. Adding Custom Fields

To display additional information for each developer or agency, you can modify the agency_developer_unit.php template. For example, to add a custom field:

<?php
$custom_field = get_post_meta(get_the_ID(), 'custom_field_key', true);
if (!empty($custom_field)) {
echo '<div class="custom-field">' . esc_html($custom_field) . '</div>';
}
?>

3. Modifying Layout

To change the layout of the developer/agency cards, you can edit the CSS classes. The main classes used are:

  • .dev_unit_wrapper (for developers)
  • .agency_unit_wrap (for agencies)
  • .agency_unit

These classes can be found in the scss/agency_developer_cards/_agency_developer_cards.scss file.

4. Adding Filters

You can add filtering options to the template by creating a form and modifying the query based on user input. For example:

<form id="developer-filter" method="get">
<select name="developer_category">
<option value="">All Categories</option>
<?php
$categories = get_terms('developer_category');
foreach ($categories as $category) {
echo '<option value="' . esc_attr($category->slug) . '">' . esc_html($category->name) . '</option>';
}
?>
</select>
<input type="submit" value="Filter">
</form>

<?php
// Modify query args based on filter
if (isset($_GET[‘developer_category’]) && !empty($_GET[‘developer_category’])) {
$args[‘tax_query’] = array(
array(
‘taxonomy’ => ‘developer_category’,
‘field’ => ‘slug’,
‘terms’ => sanitize_text_field($_GET[‘developer_category’]),
),
);
}
?>

The Developer List and Agency List templates in WpResidence provide a flexible foundation for displaying developer and agency information. By understanding their structure and the various customization points, you can tailor these templates to meet specific requirements and enhance the user experience on your real estate website.

Technical how to | Custom Code RequiredWpResidence 5.0

Related Articles

  • Introduction to WPResidence Header Customization
  • Understanding WPResidence Header Types: An Overview
  • Customizing the WPResidence Logo Display
  • Configuring the Primary Navigation Menu in WPResidence

WP Residence Documentation

  • 1. General
    • How to Get Support
    • Get your buyer license code.
    • Use SSL / https
    • Server / Theme Requirements
  • 2. Installation
  • 3. Installation FAQ
  • 4. Advanced Search
    • Advanced Search Display Settings
    • Advanced Search Form
    • Geolocation Search for Half Map
    • Save Search Theme Options
    • Advanced Search Colors
  • 5. Agent, Agency & Developers
  • 6. Property Page
  • 7. Properties List
  • 8. Property Taxonomies
  • 9. Property Custom Template
  • 10. Blog Posts & Blog List
  • 11. Shortcodes
    • Contact Form
    • Featured Agency/Developer
    • Membership Packages
    • Testimonials
    • Google Map with Property Marker
    • Listings per Agent, Agency or Developer
    • Display Categories
    • Agent List
    • Recent Items Slider
    • Recent items
    • List Properties or Articles by ID
    • Featured Agent
    • Featured Article
    • Featured Property
    • Login & Register Form
    • Icon Content Box Shortcode
  • 12. Widgets
  • Theme Options
    • General Settings
    • User Types Settings
    • Appearance
    • Logos & Favicon
    • Header
    • Footer Style and Colors
    • Price & Currency
    • Property Custom Fields
    • Features & Amenities
    • Listing Labels
    • Theme Slider
    • Permalinks
    • Splash Page
    • Social & Contact
    • Map Settings
    • Pin Management
    • How read from file works
    • General Design Settings
    • Custom Colors Settings
    • Header Design & Colors
    • Mobile Menu Colors
    • User Dashboard Colors
    • Print PDF Design
    • Property, Agent, Blog Lists Design Settings
    • Sidebar Widget Design
    • Font management
    • How to add custom CSS
    • Custom Property Card Unit – Beta version
    • Email Management
    • Import & Export theme options
    • reCaptcha settings
    • YELP API Integration
    • iHomefinder Optima Express IDX
    • MEMBERSHIP & PAYMENT Settings
    • Property Submission Page
    • PayPal Setup
    • Stripe Setup
    • Wire Transfer Payment Method
  • Translation
  • FAQ
  • Pages
  • Header
  • Footer
  • Google or Open Street Maps
  • Payment Options
  • Plugins
    • Included Plugins
    • Third Party Plugins – IDX Compatibility
    • Third Party Plugins – Multi Languages
    • Third party Plugins – Other
  • Technical
    • Technical how to | Custom Code Required
    • Technical: Child Theme
  • Theme Updates

Join Us On

Powered by WP Estate - All Rights Reserved
  • WpEstate
  • How to Build Your Website
  • Video Tutorials
  • Client Support
  • API