Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Shortcode in results box › Reply To: Shortcode in results box
January 18, 2021 at 2:15 pm
#31184
Keymaster
Hi,
It is not possible via the options, but programmatically via the asp_results plugin hook.
For example, if you would want to execute the shortcode ‘[my_shortcode]’ shortcode and append to the result content, this code does it:
add_filter( 'asp_results', 'asp_custom_shortcode_results', 10, 1 );
function asp_custom_shortcode_results( $results ) {
// Parse through each result item
foreach ($results as $k=>&$r) {
if ( isset($r->post_type) ) {
$r->content .= do_shortcode('[my_shortcode]');
}
}
return $results;
}