Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Same result behavour (no highlighted word but show up) › Reply To: Same result behavour (no highlighted word but show up)
January 23, 2023 at 10:34 am
#41038
Keymaster
Hi,
No worries, I will help you.
It is actually there, but it’s not showing up because its in brackets: https://i.imgur.com/0lJ8VPx.png
Those brackets are interpreted as a shortcode and WordPress executes it as an empty string. There is a way of getting around it though via a simple custom code:
add_filter('asp_results', 'asp_force_fulltext_description');
function asp_force_fulltext_description($results) {
foreach($results as $k=>&$r){
$content = get_the_content(null, null, $r->id);
$page_num = get_post_meta($r->id, 'page_num', true);
$r->content = "<p style='margin-top: 0px;margin-bottom: 15px;'>$content</p><span>$page_num</span>";
}
return $results;
}
This will fetch the raw content, without the shortcodes rendered, and replace it for the search results. It should display the missing text.