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 1 year ago.
- AuthorPosts
- March 7, 2022 at 9:28 am #37063
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,
AlbertMarch 7, 2022 at 9:42 am #37065Hi,
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 :)
March 7, 2022 at 10:19 am #37070Hi,
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;
}March 7, 2022 at 10:27 am #37072I think I made a mistake there, sorry about that, try this one, this will work:
Best,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; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 7, 2022 at 1:34 pm #37073You cannot access this content.March 7, 2022 at 1:42 pm #37074Hi,
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 :)
- AuthorPosts
You must be logged in to reply to this topic.