Integrating Autocomplete For Relevanssi with Toolset WP-Views
-
Hi, I work with Toolset Types and Views, I can create a custom search box using Views and recently Viwes integrated with Relevanssi.
I tried to use also Autocomplete For Relevanssi but it doesn’t work with Views search box.
The problem is that Views doesn’t use the standard WP <input type=”search” name=”s”> field, it uses <input type=”text” name=”wpv_post_search”>.
Another problem is that Views uses AJAX so I need a funtion to callback.
I fixed the problem customizing your plugin code to:
function wpv_autocomplete() { if (document.getElementsByName("wpv_post_search").length != 0 ) { var searchInputs = document.getElementsByName("wpv_post_search"); } else { var searchInputs = document.getElementsByName("s"); } for(var i = 0; i < searchInputs.length; i++) { var awesomplete = new Awesomplete(searchInputs[i]); awesomplete.list = ["<?php echo $iwords_list; ?>"]; awesomplete.minChars = <?php echo $afr_min_chars; ?>; awesomplete.maxItems = <?php echo $afr_max_suggestions; ?>; } } wpv_autocomplete();
So now it works on wpv_post_search and I can also call the function wpv_autocomplete().
It would be great if you could integrate your plugin with Views by default in the next release.
thanks
Umberto
- The topic ‘Integrating Autocomplete For Relevanssi with Toolset WP-Views’ is closed to new replies.