algoliasearch-wordpress | βππ ββοΈ Algolia Search plugin for WordPress | Content Management System library
kandi X-RAY | algoliasearch-wordpress Summary
kandi X-RAY | algoliasearch-wordpress Summary
The plugin provides relevant search results in milliseconds, ensuring that your users can find your best posts at the speed of thought. It also comes with native typo-tolerance and is language-agnostic, so that every WordPress user, no matter where they are, can benefit from it.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of algoliasearch-wordpress
algoliasearch-wordpress Key Features
algoliasearch-wordpress Examples and Code Snippets
Community Discussions
Trending Discussions on algoliasearch-wordpress
QUESTION
I'm trying to tweak the WordPress plugin https://github.com/algolia/algoliasearch-wordpress to suit our needs. What we want to be able to do is have a search result that will load the data up in the same page.
I have my WordPress posts and its data being indexed successfully. I have added a search box to the page, and autocomplete is being fired.
Out of the box, the WordPress plugin template wraps the result in an anchor tag and assigns it the URL of the found result. When clicked, this navigates you to that post. However, what I want to do is intercept that click and load the result in the same page without navigating away.
I have removed the href from the anchor. I have also edited the supplied autocomplete.php
template where the call to autocomplete:selected
occurs. In there I have removed the call to navigate away by removing window.location.href
.
Now I have two main issues.
1 - When the user clicks the search result I would like the input to be populate with the title of the item they clicked on. I added this in the autocomplete:selected
callback by adding $searchInput[0].value = suggestion.post_title
. Which seems to change the value of the input correctly, but as soon as I click away from the input, it is re-set back to the original typed value. So if I type 'may' and click the result 'mayonnaise', the result data can be accessed but the input returns back to 'may'. My function looks this:
ANSWER
Answered 2018-Sep-21 at 11:16Found some answers to my questions.
1 - In order to populate the input with the title of the selected search result I added a call to the setVal
method of the autocomplete object. I'[m still not sure why this is required.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install algoliasearch-wordpress
Automatic installation is the easiest option as WordPress handles the file transfers itself and you donβt need to leave your web browser. To do an automatic install of Search by Algolia, log in to your WordPress dashboard, navigate to the Plugins menu and click Add New. In the search field type βAlgoliaβ and click Search Plugins. Once youβve found our search plugin you can view details about it such as the point release, rating and description. Most importantly of course, you can install it by simply clicking βInstall Nowβ.
The manual installation method involves downloading our search plugin and uploading it to your webserver via your favourite FTP application. The WordPress codex contains instructions on how to do this here.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page