Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › action or filter to change type of search
This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko 5 years, 9 months ago.
- AuthorPosts
- December 14, 2017 at 11:26 am #15890
Hello there,
I am looking for a way to change the type of search at run time, so the user will have an option to select:
Either search by category, Or
Search by nameIs there a filter or an action I can hook to change the search form behaviour?
Thank you so much for your kind help.
Regards,
Yaniv.December 15, 2017 at 7:23 am #15894Hi!
Well, currently there is no front-end selector for enabling/disabling the search in taxonomy terms, but there are ones for choosing to search in title/content – so maybe I can suggest a possible setup and a small code snippet to covert those selectors for title/category.
I have made a test setup, that displays a drop-down filter of the ‘Search in title’ and ‘Search in content’ selectors, and the ‘Search in content’ selector is converted to a term only search via a small code snippet:
1. Use this setup on the front-end options panel: https://i.imgur.com/SQNnbiz.png
2. Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!This should do the trick, or at least help you get to the right direction.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.