"Thin" Appears in Some Search Results

Home Forums Product Support Forums Ajax Search Pro for WordPress Support "Thin" Appears in Some Search Results

This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 2 years ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #37063
    albert71
    albert71
    Participant

    Hi there,

    Ernest has done the diagnosis. of this problem. He observes:

    “I am seeing a “title” tag within one of the SVG elements in the page, printing “thin” – it is probably the title of that element. However after removing of the HTML tags, the text still remains there. It probably needs some custom code to get rid off that, however it should not be too difficult.”

    Could you provide the code to filter out “thin”?

    => Note that admin access is: https://infinitusnow.site/john316

    Blessings,
    Albert

    #37065
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

    add_filter( 'asp_results', 'aspl_remove_thin', 10, 2 );
    add_filter( 'asl_results', 'aspl_remove_thin', 10, 2 );
    function asp_hide_by_status( $results, $search_id ) {
    	$prefix = 'thin';
    	foreach ($results as $k=>&$r) {
    		if (substr($r->content, 0, strlen($prefix)) == $prefix) {
    			$r->content = trim( substr($r->content, strlen($prefix)) );
    		} 
    	} 
    	return $results;
    }

    It should hopefully do the trick 🙂 Let me know.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #37070
    albert71
    albert71
    Participant

    Hi,

    Now everything has been filtered, Everything is “No results found”.

    /**
    * Add Thin Filter Ajax.
    */
    add_filter( ‘asp_results’, ‘aspl_remove_thin’, 10, 2 );
    add_filter( ‘asl_results’, ‘aspl_remove_thin’, 10, 2 );
    function asp_hide_by_status( $results, $search_id ) {
    $prefix = ‘thin’;
    foreach ($results as $k=>&$r) {
    if (substr($r->content, 0, strlen($prefix)) == $prefix) {
    $r->content = trim( substr($r->content, strlen($prefix)) );
    }
    }
    return $results;
    }

    #37072
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I think I made a mistake there, sorry about that, try this one, this will work:

    add_filter( 'asp_results', 'aspl_remove_thin', 10, 1 );
    add_filter( 'asl_results', 'aspl_remove_thin', 10, 1 );
    function aspl_remove_thin( $results ) {
    	$prefix = 'thin';
    	foreach ($results as $k=>&$r) {
    		if (substr($r->content, 0, strlen($prefix)) == $prefix) {
    			$r->content = trim( substr($r->content, strlen($prefix)) );
    		} 
    	} 
    	return $results;
    }
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #37073
    albert71
    albert71
    Participant
    You cannot access this content.
    #37074
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Okay, I logged in to test. The snippet was not in the functions.php file (maybe you were editing the wrong folder?), so I added it there. I don’t see the “thin” word in the contents anymore – it seems to be working.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.