• Resolved strandcreative

    (@strandcreative)


    Hi,

    How do I get the autocomplete to work with a custom search facility?
    I am using this theme – https://listify-demos.astoundify.com/classic/ and they use a search facility on their home page. Is there anywhere we can assign IDs or classes to Algolia so the autocomplete works with any search?
    I got it working fine with the default wordpress widget.

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter strandcreative

    (@strandcreative)

    Update:

    I can see the jQuery that generates the drop downs:

        /* Setup dropdown menus */
        jQuery("input[name='s']:not('.no-autocomplete')").each(function (i) {

    Are there any filters or hooks available to change name=’s’? I have a custom search that uses name=’keywords’. I’d like to avoid editing core code to achieve this.

    Thanks

    Plugin Contributor rayrutjes

    (@rayrutjes)

    Hi there,

    Thanks for submitting this.

    I think we could easily add a filter to allow you to change this.

    I opened an issue here to track it: https://github.com/algolia/algoliasearch-wordpress/issues/616

    Would that work for you?

    Best,

    Thread Starter strandcreative

    (@strandcreative)

    @rayrutjes

    Thanks!
    That works perfectly for me ??

    Plugin Contributor rayrutjes

    (@rayrutjes)

    This is now available in version 2.4.0.

    You can use the algolia_autocomplete_input_selector filter hook and return your custom jQuery selector.

    Let me know if that doesn’t work for you. Make sure you use the latest version.

    Thread Starter strandcreative

    (@strandcreative)

    @rayrutjes
    Thanks!

    So like this? …

    add_filter('algolia_autocomplete_input_selector', "input[name='search_keywords']:not('.no-autocomplete')");

    Plugin Contributor rayrutjes

    (@rayrutjes)

    I would write the following:

    add_filter('algolia_autocomplete_input_selector', function() {
      return "input[name='search_keywords']";
    });

    Let me know if that works for you.

    • This reply was modified 7 years, 4 months ago by rayrutjes.
    Thread Starter strandcreative

    (@strandcreative)

    Thanks that has done the trick ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Work with custom search?’ is closed to new replies.