• Resolved bonz

    (@bonz)


    Hello,
    I’m a happy user of ajax search lite.
    I have this problem: I sell backing tracks and the plugin I use as a cart does not recognize the apostrophe and I cannot replace it for various reasons that I am not going to explain now; so I removed all the apostrophes from the posts with the apostrophe titles, only if someone searches for a backing track, example: “what’s your name” and the title of the post is “what s your name” without apostrophe, the answer is no result.
    what I ask: it is possible to make it recognize the words
    which are practically the same but without an apostrophe?
    many thanks for a possible answer
    bonz

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi,

    Well, the only possible solution I can see, is by replacing the apostrophe characters programatically before the search starts.

    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', 'asl_replace_characters', 10, 1);
    function asl_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;
    }

    Best,
    Ernest M.

    Thread Starter bonz

    (@bonz)

    fantastic! I am very, very happy
    thank you very much for solving this problem of mine
    best wishes for these holidays for you and those who love you
    greetings from Italy
    bonz

    Plugin Author wpdreams

    (@wpdreams)

    You are very welcome πŸ™‚ Happy holidays to you too.

    Please consider rating the plugin if you liked it, it is greatly appreciated.

    Best,
    Ernest M.

    Thread Starter bonz

    (@bonz)

    Sure, count on it! πŸ™‚
    bonz

    Thread Starter bonz

    (@bonz)

    I did not remember that I had already given 5 stars long ago, but I reiterated the 5 stars
    greetings from Italy
    bonz

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘search for words without apostrophe’ is closed to new replies.