Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › View Custom Query Before Ajax Search in Elementor Pro
- This topic has 11 replies, 2 voices, and was last updated 3 years, 10 months ago by
Ernest Marcinko.
-
AuthorPosts
-
July 8, 2022 at 12:27 am #38343
capstonedesign42
ParticipantHello. 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/de60424bb1fd421a8fdb5be80cc53fbbJuly 8, 2022 at 12:21 pm #38351Ernest Marcinko
KeymasterHi,
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.July 8, 2022 at 3:01 pm #38355capstonedesign42
ParticipantThanks for your reply. It is on a Page, not an archive. It’s just a plain page from the default Pages post type.
July 8, 2022 at 3:14 pm #38358Ernest 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?July 9, 2022 at 9:44 pm #38368capstonedesign42
ParticipantHi. 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!
July 11, 2022 at 2:55 pm #38382Ernest Marcinko
KeymasterOkay, 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!
July 11, 2022 at 7:27 pm #38387capstonedesign42
ParticipantYou cannot access this content.
July 12, 2022 at 9:30 am #38398Ernest Marcinko
KeymasterYou cannot access this content.
July 13, 2022 at 6:54 pm #38410capstonedesign42
ParticipantSure. Can you provide your IP and country so that I can release it? Thank you!
July 14, 2022 at 4:19 pm #38419Ernest Marcinko
KeymasterYou cannot access this content.
July 14, 2022 at 4:23 pm #38420capstonedesign42
ParticipantI went ahead and removed the blocking plugin for now. Can you test to see if you can access the site now?
July 15, 2022 at 10:04 am #38435Ernest Marcinko
KeymasterThank 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.
-
AuthorPosts
- You must be logged in to reply to this topic.