WPIntell

Source evidence

Autocomplete plugin not run

Autocomplete For Relevanssi · support · 2020-08-20T07:06:00+00:00

complaintsentiment
mediumseverity
0.93relevance
2replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

2 / 31 rows with source links

6.5% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

29 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
imeabe unresolved
Hi, We’re looking for a Autocomplete functionality for Relevanssi Plugin and we find yours. But in our case not run. We can see options when you are writing in search field. Thanks, The page I need help with: [ log in to see the link] One of my client had same issue. If you check console, it shows that Awesomplete class is not defined. This is because the inline script is loaded before the library is loaded. The solution is to ensure it loads after DOM is loaded and after the awesomplete lib is loaded. This is the solution for the maker of this plugin (main PHP script): jQuery(document).ready(function(){ 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; ?>; } }); Another problematic issue I encountered is an unnecessary DB Query at the end of the main script. Checking if Relevanssi is active is sufficient for the job. It should look like this to prevent unnecessary memory drain: // Looking if the relevanssi table exists then enable the plugin actions if(in_array('relevanssi/relevanssi.php', apply_filters('active_plugins', get_option('active_plugins')))){ add_action( 'wp_enqueue_scripts', 'afr_scripts' ); add_action( 'wp_footer', 'afr_footer_add', 50); }

Comments

2 shown
CommerceBird 2020-10-27T14:52:00+00:00

One of my client had same issue. If you check console, it shows that Awesomplete class is not defined. This is because the inline script is loaded before the library is loaded. The solution is to ensure it loads after DOM is loaded and after the awesomplete lib is loaded. This is the solution for the maker of this plugin (main PHP script): jQuery(document).ready(function(){ 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; ?>; } });

CommerceBird 2020-11-21T11:58:00+00:00

Another problematic issue I encountered is an unnecessary DB Query at the end of the main script. Checking if Relevanssi is active is sufficient for the job. It should look like this to prevent unnecessary memory drain: // Looking if the relevanssi table exists then enable the plugin actions if(in_array('relevanssi/relevanssi.php', apply_filters('active_plugins', get_option('active_plugins')))){ add_action( 'wp_enqueue_scripts', 'afr_scripts' ); add_action( 'wp_footer', 'afr_footer_add', 50); }