WP Residence Help WP Residence Help

  • WpEstate
  • How to Build Your Website
  • Video Tutorials
  • Client Support
  • API
Home / Technical how to | Custom Code Required / Technical how to: How i can add new fields / new sorting order for the properties list.

Technical how to: How i can add new fields / new sorting order for the properties list.

4776 views 1

This document works for standard property list and  for property category pages (if you chose standard display).

The property list page (property_list.php) and the property category pages (taxonomy.php) are displaying the lists using a template file called normal_map_core.php

In this file, we load another template file that contains the HTML code for the filters

get_template_part('templates/property_list_filters');

in the  property_list_filters.php  you would find the HTML code for the city, category, order etc dropdowns.  Also in this file, you would find the buttons that change the list format (from grid to list or vice versa). If you want to change or add new filters this is the place where you put the HTML code.

The “listing filtering action” –  is made via ajax. That means you would get new results without loading the page but if you leave this page the filter selection will be reset.

The filters action start when you make a selection on one of the dropdowns. At that time we call a JavaScript function called start_filtering. For ex in ajaxcalls.js at line 1525

   $('.listing_filters_head li').on('click', function (event) {

        var pick, value, parent;
        pick = $(this).text();
        value = $(this).attr('data-value');
        parent = $(this).parent().parent();
        parent.find('.filter_menu_trigger').text(pick).append('').attr('data-value', value);
        parent.find('input:hidden').val(value);

        wpestate_start_filtering(1);


    });

 

The wpestate_start_filtering()  function is defined in ajaxcalls.js around line 870. In this function, we read the value of the filters and we send those to a PHP function called ajax_filter_listings.  If you add new filters or option for filters you need to make sure you read those new values in this function and that you pass them correctly to the PHP function.

The PHP function wpestate_ajax_filter_listings() is located in ajax_functions.php around line 4000. In there we read the variables sent via ajax call  (the $_POST variables)  and compose the arguments array that will be used in a wp_query instruction.

If you add  new filters or parameters you must add those to the $arg array

For ex – in case you add a new “order by ” you need to put a new case situation in the switch block at line 4098. Any new taxonomy arguments needs to be added in the tax_query

tax_query' =>0; array(
'relation' => 'AND',
$categ_array,
$action_array,
$city_array,
$area_array
)

After the wp_query is done the property list is returned to the JavaScript function in a form of html code and this function will “append it” to the current page.

success: function (data) {
jQuery('#listing_loader').hide();
jQuery('#listing_ajax_container').empty().append(data);
jQuery('.pagination_nojax').hide();
restart_js_after_ajax();

 

How to hide a value from the dropdowns with CSS (from theme options)

You can hide a specific value from the dropdown categories with css

For exemple to hide “rentals” in a drowpdown, you can use this css code:

ul[aria-labelledby="a_filter_action"] > li[data-value="rentals"] {
display:none;
}

Technical how to | Custom Code Required

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