action or filter to change type of search

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 Ernest Marcinko 4 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15890
    Yaniv Ozana
    yozana
    Participant

    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 name

    Is 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.

    #15894
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.