Search Fields Order: Alter the order of the search fields

The displayed output of the search fields can be adjusted using the epl_search_widget_fields_frontend filter. This filter can be found in the  epl_search_widget_fields_frontend function located in widget-functions.php file.

Each field that is displayed in the search has an order option which controls the order of the field.

Listing Search style wide

[listing_search style=wide]

How to place the price first

The search_price field has a default order of 140

For example the Suburb (location taxonomy) field has an order of 40.

   'key'           => 'search_price',
   'meta_key'      => 'property_price_from',
   'label'         => __( 'Price From', 'easy-property-listings' ),
   'option_filter' => 'price_from',
   'options'       => $price_array,
   'type'          => 'select',
   'query'         => array(
   'query'   => 'meta',
      'key'     => $price_meta_key,
      'type'    => 'numeric',
      'compare' => '>=',
   'class'         => 'epl-search-row-half',
   'order'         => 140,

This order can be adjusted with the following example search-field-order.php function.

function my_epl_search_widget_fields_frontend( $fields ) {
   foreach( $fields as &$field ) {
      // Price field: search_price
      if( $field['key'] == 'search_price' ) {
         $field['order'] = '20';
      // Another field foe example.
      if( $field['key'] == 'search_location' ) {
         $field['order'] = '200';
      // Repeat the above if and alter the name
   return $fields;
add_filter( 'epl_search_widget_fields_frontend', 'my_epl_search_widget_fields_frontend' , 90 );<br>

The above results in re-ordering the fields.

The majority of fields are order incremented by 10 allowing you plenty of space to re-order all the fields.