1). SEARCH BY LOCATION:
I have a view that searches by location then sorts by proximity to visitor. I then need to sort the results by another field called "Featured Trials". I then need to highlight these Featured Trials with some CSS styling ie. box around top results, different color etc.
I could not find documentation around this.
I want this to look like the a Google SERP where the top paid advertisers are highlighted.
Here is my page: hidden link
2). TEXT INPUT SEARCH RESULTS SORT BY LOCATION OF VISITOR:
I have a view that allows a visitor to input text to search by health condition. I want the results to sort based on location of visitor. I get a warning that Relevanssi will sort by relevance and does not allow sorting by visitor location. Is there a way around this?
Thank you for getting in touch. Normally we answer 1 issue per thread. However since the problems are related then I will handle them here.
1). SEARCH BY LOCATION:
I have a view that searches by location then sorts by proximity to visitor. I then need to sort the results by another field called "Featured Trials". I then need to highlight these Featured Trials with some CSS styling ie. box around top results, different color etc.
I could not find documentation around this.
I want this to look like the a Google SERP where the top paid advertisers are highlighted.
A. Given that you are using relevanssi as well, you wouldn't be able to get the results already sorting. You can however make use of the frontend sorting feature using the sorting controls button. See Screenshot
This way users will have the option to sort the view.
Regarding here " I then need to highlight these Featured Trials with some CSS styling ie. box around top results, different color etc."
You can make use of our conditional code in order to the items differently. So if a post is a Featured trial then you will add it with a different class vs one without. Example
[wpv-conditional if="( '[types field='my-featured-field'][/types]' eq 'featured')"]
<div class='featured'>
some content with special styling
</div>
[/wpv-conditional]
[wpv-conditional if="( '[types field='my-featured-field'][/types]' new 'featured')"]
<div >
some content without special styling
</div>
[/wpv-conditional]
2). TEXT INPUT SEARCH RESULTS SORT BY LOCATION OF VISITOR:
I have a view that allows a visitor to input text to search by health condition. I want the results to sort based on location of visitor. I get a warning that Relevanssi will sort by relevance and does not allow sorting by visitor location. Is there a way around this?
A. Similar to my answer above you won't be able to use the regular sorting to do this.
#2 ) Can I create a secondary sort by zipcode or Visitor Location with custom code?
You wouldn't need to use custom code because as long as these fields are types fields then you should be able to use the frontend sorting control as well to add frontend sorting for these fields.
I decided to reconfigure my search feature. Please take a look at this page:
hidden link
I have a dropdown with the health conditions that is supposed to sort the results by distance from Visitor location. I am in Florida and when I choose "Endocrinology", the Wisconsin result shows up first (it should be last). The rest of the sort is fine. Same thing when I try to search by "Gastroenterology". It is not in the correct order at all.
Here is how i have it set up in Toolset View (see screenshots).
Here is admin access to my site if you want to go in there: