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 2 years, 8 months ago.
- AuthorPosts
- August 16, 2020 at 2:34 pm #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
August 17, 2020 at 9:33 am #29000Hi,
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.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 14, 2020 at 11:07 am #29334Ok, 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:
https://support.yotpo.com/en/article/loading-yotpo-with-ajaxHow can I run this javascript widget at the right time without your plugin?
Thanks
-
This reply was modified 2 years, 8 months ago by
yonahs61332.
-
This reply was modified 2 years, 8 months ago by
- AuthorPosts
You must be logged in to reply to this topic.