Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Exact match
- This topic has 9 replies, 2 voices, and was last updated 8 years, 8 months ago by
Ernest Marcinko.
-
AuthorPosts
-
September 28, 2017 at 6:17 pm #14934
splash94
ParticipantHi,
try to write “Milano” and then try to search “Milano Marittima”. They are two different cities but when you write Milano Marittima the drivers of Milano appear too.
Is there a method to let appear only the Milano Marittima drivers?
ThanksSeptember 29, 2017 at 8:43 am #14937Ernest Marcinko
KeymasterHi,
Probably the easiest and fastest solution would be to simply turn on Exact matches on the General Options -> Logics & Behavior panel: https://i.imgur.com/e64LMsm.png
I hope this helps.
September 29, 2017 at 9:10 am #14942splash94
ParticipantOk, thanks this helped a lot! But if I write “milano” the last result is the driver of “milano marittima” . Do you know a method to exclude him from the milano search?
Thank you very much and have a nice day
FrancescoSeptember 29, 2017 at 1:01 pm #14945Ernest Marcinko
KeymasterHi Francesco,
Well, there is no configuration to do that, as ‘milano’ will always match ‘milano marittima’. But, there is a way to do that with a custom code. I’ve made a small code snippet for you, that will change the search query arguments and exclude post 16070 aka ‘Transporter Sas’ when the phrase is ‘milano’.
Add this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
IMPORTANT: Before making any direct changes in your site files, please make sure you have a back-up of everything. To edit the files, I highly recommend using an (s)FTP client, instead of the internal file editor in WordPress – as any tiny mistake there can potentially lead to a site error.
Let me know if you need help with this 🙂
September 29, 2017 at 2:22 pm #14954splash94
ParticipantThank you very much!!! Fantastic!
September 29, 2017 at 2:23 pm #14955Ernest Marcinko
KeymasterYou cannot access this content.
October 5, 2017 at 10:13 pm #15028splash94
ParticipantHi, in italian works great! Is there a method to exclude the phrase beside the uppercase? I mean, I want to exclude “milano” but the script has to exclude also “Milano” and “MILANO”. Just tell if is it possible in a simple way or if I need to add a line for every possibility.
Thanks
Francesco-
This reply was modified 8 years, 8 months ago by
splash94.
October 6, 2017 at 9:16 am #15031Ernest Marcinko
KeymasterHi Francesco,
I totally forgot about that possiblity. There is actually a very simple way, no need to add the variations one by one. I have made a change to the code, so now the phrases are converted to lower case before comparison:
This should work, no matter which letters are lower-upper case.
October 6, 2017 at 9:24 am #15033splash94
ParticipantThat’s fantastic! Already tested and it works good!
I’ve rated you 5 stars on codecanyon, fantastic support.
Thanks a lot
FrancescoOctober 6, 2017 at 9:25 am #15034Ernest Marcinko
KeymasterYou cannot access this content.
-
This reply was modified 8 years, 8 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.