There are two type of listings templates – the half map one and the normal map

Regular property listing

The classic property listing is created by making a page with the template “Properties List”. The file for this is property_list.php and is located in the root of the theme folder.

We only use wp_query for querying the WordPress database. In this case the query is located at line 190 or line 193. The query at line 190 has a filter before. This is used in cases where the order is default one and the featured properties needs to go first.

At line 170 you have a big array with arguments for the WP_Query that follows. You can do a
print_r($args);
and see how the query is constructed

The order of the listings is set at line 136 in the

$meta_directions = 'DESC';
$meta_order = 'prop_featured';
$order = get_post_meta($post->ID, 'listing_filter',true );
switch ($order){
case 1:
$meta_order='property_price';
$meta_directions='DESC';
break;
case 2:
$meta_order='property_price';
$meta_directions='ASC';
break;
case 3:
$meta_order='property_size';
$meta_directions='DESC';
break;
case 4:
$meta_order='property_size';
$meta_directions='ASC';
break;
case 5:
$meta_order='property_bedrooms';
$meta_directions='DESC';
break;
case 6:
$meta_order='property_bedrooms';
$meta_directions='ASC';
break;
}

So if you want to add a new order type or change the existent one the above code is the one you need to change.

The taxonomy part of the array is built in the beginning of the file starting with line 40.

The “display” part is happening in a different file we include at line 196

get_template_part('templates/normal_map_core');

Right in the beginning of the page there is the code that “builds” the list. We gather all the listings in the $templates variable which will display later on.

ob_start();
while ($prop_selection->have_posts()): $prop_selection->the_post();
get_template_part('templates/property_unit');
endwhile;
$templates = ob_get_contents();
ob_end_clean();

The property_unit.php file is the one that actual show the property unit or property card. See image below to understand what is kept in there.

property_unit

After that the most important part is the property list filters that are included at like 88

property_filters

Pagination is at line ~ 106

while the sidebar is loaded at ~ line 110

Half Map listings

The half map property listing is created by making a page with the template “Properties list half”.  The file for this is property_list_half.php and is located in the root of the theme folder.

The structure of the page follows the classic one property list.  The order parameters, taxonomies, and other arguments for the query are built in the same way as in the classic version.

The differences are at line 194 where we request the

get_template_part('templates/half_map_core');

And the read from file code that is just below.

In the half_map_core.php file we create the listing right in the beginning.
ob_start();
while ($prop_selection->have_posts()): $prop_selection->the_post();

if($listing_unit_style_half == 1 && $listing_type!=1){
get_template_part(‘templates/property_unit_wide’);
}else{
get_template_part(‘templates/property_unit’);
}
endwhile;

$templates = ob_get_contents();
ob_end_clean();

The property_unit_wide is the wide version you can set in theme admin-> Appearance -> Property Unit Style for Half Map – the list option . We build the properties list in the $templates variable which we display at line 63.

property_unit_wide

The actual map is loaded at line 28

get_template_part('templates/google_maps_base_map_list');

Another important thing is the code at line 34

get_template_part('templates/advanced_search_map_list');

Here we load the half map filters parameters.

If you need additional explanations about how to implement the merchant please post a ticket at support.wpestate.org and will update this document.

General Guidelines to change the default list order

Properties are listed by custom order (featured status first and by property ID = wordpress publish date next)

To change order look for

'meta_key' => 'prop_featured',
'orderby' => 'meta_value',
'order' => 'DESC',

Replace with your new order. Ex, to order by price DESC

'meta_key' => 'property_price',
'orderby' => 'meta_value_num',
'order' => 'DESC',

Make sure you write PHP, not copy/paste. So you don’t copy wrong formatting.

You also need to remove the custom order of listing!!!!!

Modify in 2 places:

Apply the same code for

Search Results Page location in wprentals/libs/search_functions3.php

Disable theme custom order

Change Order in Taxonomy List / Category List

For Taxonomy list the PHP file where you need to apply the same code is wprentals/taxonomy.php
Taxonomy order is disabled from plugin (it is an envato requirement)
plugins/wprentals-core/misc/plugin_help_functions.php (attached file)
Comment as in the attached screenshot