Sort by location not working – Fatal Error

Tagged:
  • wpsolr
    Keymaster
    10 months, 2 weeks ago #33008

    Usually, the search url is not open from a hyperlink, but from an outside search form (home page, or top header).

    If you use option “Attach the geo localization js to your own search form(s)” to include those search forms too, the form will add the lat,long parameters to the search url automatically.

    10 months, 2 weeks ago #33016

    Okay, I got it, actually in our scenario, we have search url linked to a menu item, so we are having this issue..
    And I dont want to show the location sort in widget, Any option to hide in frontend ?

    wpsolr
    Keymaster
    10 months, 2 weeks ago #33017

    Some CSS or javascript?

    10 months, 1 week ago #33058

    I was checking if this can be done by a hook? or php code

    wpsolr
    Keymaster
    10 months, 1 week ago #33061

    You can use this hook:

    
    use wpsolr\core\classes\WPSOLR_Events;
    
    add_filter( WPSOLR_Events::WPSOLR_FILTER_SORT_FIELDS, 'wpsolr_filter_sort_fields', 10, 1 );
    
    public function wpsolr_filter_sort_fields($default_sort_fields) {
       return $default_sort_fields; // array of field names
    }
    10 months, 1 week ago #33062

    Okay, unsetting will not break the functionality of still using it as a filter with direct url I guess …

    wpsolr
    Keymaster
    10 months, 1 week ago #33063

    It should be fine.

    You can also unset it when no lat,long parameters appear in the url.

Viewing 7 posts - 31 through 37 (of 37 total)

You must be logged in to reply to this topic.