Support » Plugin: Ajax Search Lite » Keywords problem

  • Hello, I have a question and a problem. Can the plugin ignore the “:” sign? Because I have the product name: “Custom ABC Product 1” and when I enter “Custom ABC: Product 1” the program finds nothing.

    Thank you in advance.

Viewing 1 replies (of 1 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi,

    Sure, but only via custom coding unfortunately. Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

    add_filter('asl_search_phrase_before_cleaning', 'asp_replace_characters', 10, 1);
    function asp_replace_characters( $s ) {
      $characters = "',._-?!:"; // Type characters one after another
      $replace_with = ' ';     // Replace them with this (space by default)
      if ( is_array($s) ) {
        if ( isset($s['s']) && !$s['_ajax_search'] ) 
          $s['s'] = str_replace(str_split($characters), $replace_with, $s['s']);      
      } else {
        $s = str_replace(str_split($characters), $replace_with, $s);
      }
      return $s; 
    }

    This should do the trick.

    Best,
    Ernest M.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.