Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › "Thin" Appears in Some Search Results
- This topic has 5 replies, 2 voices, and was last updated 4 years, 2 months ago by
Ernest Marcinko.
-
AuthorPosts
-
March 7, 2022 at 9:28 am #37063
albert71
ParticipantHi 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 #37065Ernest Marcinko
KeymasterHi,
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.
March 7, 2022 at 10:19 am #37070albert71
ParticipantHi,
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 #37072Ernest Marcinko
KeymasterI 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; }March 7, 2022 at 1:34 pm #37073albert71
ParticipantYou cannot access this content.
March 7, 2022 at 1:42 pm #37074Ernest Marcinko
KeymasterHi,
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.
-
AuthorPosts
- You must be logged in to reply to this topic.