Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › the option does not work › Reply To: the option does not work
January 7, 2019 at 5:35 pm
#20663
Keymaster
Hi,
The ‘Description context’ option is not for removing the first X characters from the results content. That is only possible via a custom code.
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! Change the $remove variable to the number of characters you want to remove.
add_filter('asp_results', 'asp_remove_first_n_characters');
function asp_remove_first_n_characters($results) {
$remove = 200;
foreach ($results as $k => &$r) {
if ( strlen($r->content) > $remove )
$r->content = substr($r->content, $remove);
}
return $results;
}