Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Adding shortcode to results
This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko 1 year, 4 months ago.
- AuthorPosts
- November 14, 2021 at 10:00 pm #35536
Hey,
I am trying to add a compare option for posts that will appear in the search results of the Ajax Search Pro plugin.
All I need to do is add a shortcode to the results and this will work.
However I am not able to add a shortcode in any way, even when I try adding the shortcode as a custom value of the post.
Is there any other way I could add such a shortcode to the search results?
I can even add some code to the necessary file if needed.November 15, 2021 at 10:43 am #35550Hi!
A bit of a custom code is required, but no need to edit the files. This knowledge base will help you with it. Let me know if you need any assistance with that.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
November 16, 2021 at 2:14 am #35570Thanks ! That did the trick
November 16, 2021 at 9:37 am #35572You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
November 16, 2021 at 7:09 pm #35596Sorry I just stumbled on another issue.
Is it possible to trigger a custom function on every search?
Meaning right after the search results appear I want to fire the function.
Please let me know how I could add such a functionality.Thanks
November 18, 2021 at 9:41 am #35610Yes, you can.
If you mean the server side (PHP), then you can use the asp_results filter. That is triggered whenever the search is finished and before the output. You can use it as an action hook instead of a filter as well:
add_action( 'asp_results', 'asp_my_custom_results_action', 10, 4 ); function asp_my_custom_results_action( $resultsi, $search_id, $is_ajax, $args) { // Do your thing here }
If you mean javascript code executed on the front-end, that is also possible. Check this knowledge base for that.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.