• 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]

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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);
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Autocomplete plugin not run’ is closed to new replies.