Support » Plugin: WP Search with Algolia » Search result to display in new section
Search result to display in new section
-
How can we move the auto suggestions of a search box to a new section not just beneath the search box?
-
Hi @swethabc9
We still ship with Autocomplete version 0.38 at the moment, so the best documentation for autocomplete customization is going to be at https://github.com/algolia/autocomplete/tree/v0.38.0
That said, I noticed they have a global options section at https://github.com/algolia/autocomplete/tree/v0.38.0#global-options
It lists a “dropdownMenuContainer” property that can be used to specify where to show the results, from what I’ve seen and tinkered with. You’d use it like such, to specify the “my-div” ID div markup:
dropdownMenuContainer: '#my-div',
You would want to place that alongside https://github.com/WebDevStudios/wp-search-with-algolia/blob/main/templates/autocomplete.php#L155-L163 like so:
templates: { empty: wp.template( 'autocomplete-empty' ) }, dropdownMenuContainer: '#my-div',
Not sure if you’ve done any template customizations yet, but here’s a wiki page to help get you started there, if not.
https://github.com/WebDevStudios/wp-search-with-algolia/wiki/Customize-the-Autocomplete-dropdown
Hi @tw2113
Thank you soo much for your reply. But this is not what I’m looking for. For eg:
https://ps.w.org/wp-search-with-algolia/assets/screenshot-4.png?rev=2089450
In this above image we can see that the when we type in search box the result appear just below that box. Instead of that I need to display the result on another section below this search form. Also my search works on a pop up and inside that pop up I need this search box and a div or section where the search result will be shown. Is it possible with this plugin?
Not sure how to best handle the search being in a popup detail. I do still believe my point above is accurate.
Below is a screenshot of myself using the TwentyEleven theme and I set the
dropdownMenuContainer
property to'#secondary'
which is putting the results in the sidebar further down the page and below the header.Other than that, I may need some extra screenshots and a link to better visualize everything.
Hi @tw2113
Thank you soo much, It worked for me very well. Also when I clicked some where on the screen this search result box that is ‘aa-dropdown-menu’ gets disappear and when I continue typing is gets displayed. Is there any way to block it from hiding once the search result is shown?
Hi @tw2113
I also have a doubt is there any way to show search result count like
104 results for xyz below the search box.For keeping the dropdown showing still, the closest I can think of would be whatever may be available from https://www.algolia.com/doc/api-reference/widgets/search-box/js/ which is their documentation for the search box widget.
Regarding search statistics, I know there’s https://www.algolia.com/doc/api-reference/widgets/stats/js/ but I think that’s a bit more InstantSearch than autocomplete.
Hi @tw2113
Thank you soo much for you help.
Welcome.
- The topic ‘Search result to display in new section’ is closed to new replies.