The advanced search form that is present over the header can be found in 2 variations (one is on the right part of the header the other one is wide , at the header bottom) . The html code for these 2 can be found in templates folder : advanced_search_type1.php or advanced_search_type2.php

If you want to add new search fields or change the existing ones you should start from those 2 files.

When the search button is pressed the search parameters are sent to advanced_search_results.php.

In there the we retrieve the search parameters as $_GET variables and use this to build and arguments array called $arg who is used by WP_Query worpdress function to retrieve the results.  If you are not familiar with how wp_query works you shoudl read this article : . If you are planing to do a change in how the search script works it is mandatory to understand how wp_query works.

Please note that there 2 situations – when user search for start and end date and when not. The difference is made at this line

if ( $book_from!='' && $book_from!='' ){

If the start date and end date are used then we first do a query for geo location parameters and after that we check the received results for availability by doing a second wp_query using the ”  ‘post__in’                =>    $right_array”

while ($prop_selection->have_posts()): $prop_selection->the_post();
// print ‘</br>we check ‘.$post->ID.'</br>’;
if( wpestate_check_booking_valability($book_from,$book_to,$post->ID) ){

$args = array(
‘cache_results’ => false,
‘update_post_meta_cache’ => false,
‘update_post_term_cache’ => false,
‘post_type’ => ‘estate_property’,
‘post_status’ => ‘publish’,
‘paged’ => $paged,
‘posts_per_page’ => $prop_no,
‘post__in’ => $right_array


After the wp_query is made we load one of the property list templates : half map or classic ones

if ( $property_list_type_status == 2 ){

In both templates we loop trough the results and build the property list with code like

while ($prop_selection->have_posts()): $prop_selection->the_post();


while ($prop_selection->have_posts()): $prop_selection->the_post();

if($listing_unit_style_half == 1 && $listing_type!=1){


Notes :

  • – Order is changed by changing  ‘orderby’ => ‘meta_value’, ‘order’ => ‘DESC’, parameters (and meta_key if you order by a meta post) in $args
  • – Categories are used/search by using the tax_query parameters
  • – Parameters like beds, price etc are used/search by using the meta_query parameters
  • – ALL YOUR ANSWERS are in wp_query official documentation : . You just need to have the patience to go trough all the info 🙂

Half Map

The search in half map is done in a different way but also using the wp_query function.

The half map search/filtering form is located in advanced_search_map_list.php. If you want to add/edit something you should start with this file

When you change a value of a search field a .change event is triggered in javascript and the function start_filtering_ajax_map() is called. This function is located in ajaxcalls.js at line 6.

In this function, we read the input fields and send the data to a PHP function via an ajax calls. If you add new search parameters you need to make sure you read their value and that you send those values via the ajax call.

The PHP function that retrieves the data is called wpestate_ajax_filter_listings_search_onthemap and is located in ajax_functions.php at line 3186.

In there we retrieve all parameters as $_POST vars and use those to build an argument array called $args that will be used by the wp_query calls. The code in this function is very similar to the one in advanced_search_results.php. file

After we get the results – we return to the javascript function that will insert those into the page as “search results”.

There are also 2 additional search forms – in the widget and in shortcodes. Both of these search forms will work as the search in the header using the advanced_search_results.php file.

Widget : in plugins/wprentals-core/widgets/advanced_search.php

Shortcode : in shortocodes.php function wpestate_advanced_search_function() at line 650

Technical Guest Variable –