WP Residence Help WP Residence Help

  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API
Home / Technical how to | Custom Code Required, WPResidence 5.0 Documentation / Understanding and Customizing Property List Templates in WpResidence

Understanding and Customizing Property List Templates in WpResidence

707 views 0

Understanding and Customizing Property List Templates in WpResidence

Introduction

The property_list.php and property_list_half.php files are key templates in the WpResidence theme, responsible for displaying property listings in different layouts. These files can be found in the root directory of the WpResidence theme.

Template Structure and Functionality

1. property_list.php

This template displays a full-width list of properties. Here’s a breakdown of its main components:

1.1 Template Declaration

At the top of the file, you’ll find:

/**
* Template Name: Properties list
*
* @package WpResidence
*/

This declares the template name, making it selectable in the WordPress page attributes.

1.2 WpResidence Core Plugin Check

The template checks for the WpResidence Core plugin:

if (!function_exists('wpestate_residence_functionality')) {
wp_die(esc_html__('This page requires the WpResidence Core Plugin. Please activate it from the plugins menu!', 'wpresidence'));
}

This ensures that the necessary functionality is available.

1.3 Variable Initialization

The template initializes various variables used throughout the page:

$wpestate_currency = esc_html(wpresidence_get_option('wp_estate_currency_symbol', ''));
$where_currency = esc_html(wpresidence_get_option('wp_estate_where_currency_symbol', ''));
$wpestate_prop_unit = esc_html(wpresidence_get_option('wp_estate_prop_unit',''));
$property_number_to_show = intval(wpresidence_get_option('wp_estate_prop_no', ''));
$curent_fav = wpestate_return_favorite_listings_per_user();

These variables are fetched from theme options and user data. The functions used here can be found in the WpResidence Core plugin, typically in files like estate_functions.php or estate_options.php.

1.4 Query Arguments and Property Selection

The template creates query arguments and selects properties:

$temp_arguments = wpresidence_create_arguments_for_property_list($post->ID);
$arguments_array = wpestate_create_query_arguments($temp_arguments);
$args = $arguments_array['query_arguments'];
$transient_appendix = $arguments_array['transient_appendix'];

These functions (wpresidence_create_arguments_for_property_list and wpestate_create_query_arguments) can be found in the WpResidence Core plugin, typically in a file like estate_property_lists.php.

1.5 Property Selection and Caching

The template attempts to retrieve cached property selections:

$prop_selection = wpestate_request_transient_cache('wpestate_prop_list'.$transient_appendix);
if($prop_selection == false){
if($order == 0){
$prop_selection = wpestate_return_filtered_by_order($args);
} else {
$prop_selection = new WP_Query($args);
}
wpestate_set_transient_cache('wpestate_prop_list'.$transient_appendix, $prop_selection, 60*60*4);
}

This caching mechanism improves performance by storing query results. The caching functions can typically be found in a file like estate_caching.php in the WpResidence Core plugin.

1.6 Template Inclusion

The template includes the core display logic:

include(locate_template('templates/properties_list_templates/property_list_page_normal_map_core.php'));

This file contains the HTML structure for displaying the property list.

2. property_list_half.php

This template is similar to property_list.php but displays properties in a half-map layout. The main differences are:

2.1 Template Declaration

// Template Name: Properties list half

2.2 Template Inclusion

Instead of the normal map core, it includes:

include(locate_template('templates/properties_list_templates/property_list_page_half_map_core.php'));

This file contains the HTML structure for the half-map layout.

Customization and Extension

1. Modifying Property List Order

The property list order can be modified by changing the ‘listing_filter’ post meta. You can add a custom field to your property list page and set its value to change the ordering. The order values are defined in the theme and typically include options like ‘default’, ‘price_high’, ‘price_low’, etc.

2. Changing Property Card Layout

To modify the property card layout, you can create a child theme and override the property card templates. For example, to change the layout of Type 1 property cards:

  1. Create a folder in your child theme: ‘templates/property_cards_templates/’
  2. Copy ‘property_unit_type1.php’ from the parent theme to this new folder
  3. Modify the copied file as needed

CSS Customization

The main CSS classes for property listings can be found in the following SCSS files:

  1. /sass/_property_lists.scss: Contains styles for overall list layouts
  2. /sass/_property_unit.scss: Contains styles for individual property units
  3. /sass/_property_units_type1.scss (and similar files for other types): Contains specific styles for each property card type

To customize these styles, it’s recommended to use a child theme and create a custom CSS file that overrides the necessary styles.

Technical how to | Custom Code RequiredWPResidence 5.0 Documentation

Related Articles

  • Webhook Integration for Contact Forms
  • Technical: Change the Schedule Tour Email Text and the Form Default Message
  • Property list filter customization
  • Technical – How to Change the Minimum Image Dimensions for Property Uploads in WPResidence

Help Categories

  • 19Agent, Agency & Developers
  • 7Blog Posts & Blog Lists
  • 38Elementor Shortcodes Built-In
  • 55FAQ
  • 15Footer
  • 5Getting Started
  • 37Header
  • 2IDX & MLSImport
  • 6Installation & Setup
  • 22Installation FAQ
  • 23Maps & Location Settings
  • 21Multi-Language Third Party Plugins
  • 6Other Third party Plugins
  • 19Pages
  • 4Payments & Monetization
  • 20Property Lists, Categories & Archive
  • 36Property Pages & Layouts
  • 31Search & Filtering
  • 163Technical how to | Custom Code Required
  • 8Technical: Actions and filters
  • 6Technical: Child Theme
  • 85Theme Options & Global Settings
  • 6Translations & Languages
  • 16WPBakery Shortcodes
  • 51WPResidence / WPEstate CRM
  • 50WPResidence 5.0 Documentation
  • 7WPResidence Elementor Studio
  • 50WPResidence Translate Plugin

Join Us On

Powered by WP Estate - All Rights Reserved
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API