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 / Understanding and Customizing Property List Templates in WpResidence

Understanding and Customizing Property List Templates in WpResidence

208 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

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