Adding shortcode to results

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 Ernest Marcinko 1 year, 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #35536
    yair07
    yair07
    Participant

    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.

    #35550
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


    #35570
    yair07
    yair07
    Participant

    Thanks ! That did the trick

    #35572
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


    #35596
    yair07
    yair07
    Participant

    Sorry 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

    #35610
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Yes, 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 :)


Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.