Shortcode in Search results not working

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Shortcode in Search results not working

This topic contains 2 replies, has 2 voices, and was last updated by yonahs61332 yonahs61332 3 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #28981

    I understand that the [] are used as conditional tags, so how am I supposed to enter a shortcode?

    I have tried [shotcodeText] one and it just displays the ShortCode as text

    I am talking about the Advanced Fields section on Advanced Options->Content

    I have tried the “Execute them” and “Remove Them” options

    Ernest Marcinko
    Ernest Marcinko


    In short, you cannot enter shortcodes there. Most shortcodes are registered in a loop or single content sections, and may require additional parameters to work.

    The only way you should try that, is programatically adding the shortcode to the content via the asp_results hook.

    Something like this:

    add_filter( 'asp_results', 'asp_add_custom_shortcode', 10, 1 );
    function asp_add_custom_shortcode( $results ) {
    	foreach ($results as $k=>&$r) {
    		// Enter the shortcode into the quotes section
    	  	$r->content = do_shortcode('[my_shortoce_here]') . $r->content;
    	return $results;

    Still, this may not work, as shortcodes should be optimally added inside the post editor directly, otherwise they might not process correctly.

    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    Ok, I have solved my problem, I have customized the Horizontal template and the shortcode HTML is there, but there is still a problem and the solution seems simple enough, but I need some help implementing it:

    How can I run this javascript widget at the right time without your plugin?


    • This reply was modified 3 years, 10 months ago by yonahs61332 yonahs61332.
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.