Change the order of search result in Wilcity Search V2

In default, the search result will showing the result in order like this:

for example, we query the keyword “A”, the search result will return the result in order >> result from location include “A” >> result with the keyword “A” in wordpress.

To change this order, please replace the SearchFormController.php in plugins/wiloke-listing-tools/app/Controllers/SearchFormController.php

with this file:

https://www.dropbox.com/s/2ekqvojrgxkjifm/SearchFormController.php?dl=0

and add this filter to functions.php of the child theme:

add_filter('wilcity/filter/wiloke-listing-tools/app/SearchFormController/search-target', function($aSearchTarget) {
    $aNewSearchTarget = [];
    if (in_array('listing', $aSearchTarget)) {
        $aNewSearchTarget[] = 'listing';
    }
    foreach ($aSearchTarget as $target) {
        if ($target === 'listing') {
            continue;
        }        $aNewSearchTarget[] = $target;
    }    return $aNewSearchTarget;
});

Leave A Comment?