View Custom Query Before Ajax Search in Elementor Pro

Home Forums Product Support Forums Ajax Search Pro for WordPress Support View Custom Query Before Ajax Search in Elementor Pro

This topic contains 11 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 1 year, 9 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #38343
    capstonedesign42
    capstonedesign42
    Participant

    Hello. I have an archive page with Ajax Search Pro and it seems to work fine except for one thing. The page is a page with the Elementor Posts Widget that pulls in the default posts. So, when you visit the page, with Ajax Search Pro on it, you see the search bar and filter checkboxes, along with the posts that the default query (posts only) pulls in.

    I would like to be able to assign a custom query so that the Posts widget displays Posts, and Resources (custom post type). When I create a custom query and add it to the custom query ID field in the Post widget in Elementor, I see the Posts and Resources. However, one the front end when I click on the checkboxes in the Ajax Search Pro filter boxes, the search results do NOT update. You get the same custom query search results. Is there anything I can do?

    Here is a screencast to show what I am talking about.
    https://www.loom.com/share/de60424bb1fd421a8fdb5be80cc53fbb

    #38351
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    If I understood correctly you are running the widget on an archive page. That is the problem. The archive query overrides whatever Ajax Search Pro tries to display.
    The Posts/Products widget filtering only works for singular pages at the moment. We will probably implement support for archive pages as well sometime in the future, for now it is very problematic unfortunately.

    Best,
    Ernest Marcinko

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


    #38355
    capstonedesign42
    capstonedesign42
    Participant

    Thanks for your reply. It is on a Page, not an archive. It’s just a plain page from the default Pages post type.

    #38358
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    – Do you use any Elementor addons (query modification etc..)?
    – If you turn off the custom query feature, does it change anything?
    – Does anything change if you enter a search phrase?

    Best,
    Ernest Marcinko

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


    #38368
    capstonedesign42
    capstonedesign42
    Participant

    Hi. I am not aware of any jquery modifications and such. I am not sure what you mean by turn off the custom query feature. When I enter a search phrase nothing happens. I am happy to provide a login for the site if that helps you. Thank you!

    #38382
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Okay, this does not sound like a configuration issue then, I will have to debug it via editing the code.

    Can you pelase add temporary FTP and back-end access? I will have do debug the queries by editing files, as well as change the settings temporarily if needed. Thank you!

    Best,
    Ernest Marcinko

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


    #38387
    capstonedesign42
    capstonedesign42
    Participant
    You cannot access this content.
    #38398
    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 :)


    #38410
    capstonedesign42
    capstonedesign42
    Participant

    Sure. Can you provide your IP and country so that I can release it? Thank you!

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


    #38420
    capstonedesign42
    capstonedesign42
    Participant

    I went ahead and removed the blocking plugin for now. Can you test to see if you can access the site now?

    #38435
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank you very much, that worked perfectly.

    I think I found the best possible solution to this. At first it seemed it may not be possible, but there is such a simple way to solve this.
    I have changed your custom query code via FTP to this:

    function my_query_by_post_types( $query ) {
    	if ( !isset($_GET['asp_ls']) ) {
    		$query->set( 'post_type', [ 'post', 'resources' ] );
    	}
    }
    add_action( 'elementor/query/insightsquery', 'my_query_by_post_types' ); 

    All this does, is basically ignore your query arguments, when the asp_ls server reqest variable is detected. When that variable exists, it means, that Ajax Search Pro is instructed to override the elementor posts. By ignoring the query arguments in that case, the search can safely override the default Elementor results.

    Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.