Forum Replies Created
-
AuthorPosts
-
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterHi,
I guess there is a custom script image lazy loader feature enabled on the results widget somewhere.
Either way, I found a possible event listener, which should trigger the “loading” of the images as it signals that the ajax search is complete and bricks will start loading the images afterwards:
add_action('wp_footer', 'asp_custom_footer_script', 99999); function asp_custom_footer_script() { ?> <script> document.addEventListener("DOMContentLoaded", (event) => { document.querySelectorAll(".asp_main_container").forEach(function(el){ el.addEventListener("asp_search_end", function(event) { document.dispatchEvent(new Event("bricks/ajax/load_page/completed")); }); }); }); </script> <?php }Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
I have opened an issue on the tracker to make sure this is patched for the upcoming release, as it is a very simple solution.
Ernest Marcinko
KeymasterYou cannot access this content.
December 15, 2023 at 1:51 pm in reply to: Issues in configuring sitewide search result with Elementor archive posts #46374Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterHi,
Sure!
Using the index table engine should solve this issue. On the index table options make sure that the index post author is enabled before creating the index.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterI’m not sure if there is a way then I’m afraid 🙁
You could still try to experiment with 2 widgets and use the custom code above to try to hide the first widget when the search is starting out. Other than that I don’t think there is a different solution.
Ernest Marcinko
KeymasterHi,
Thank you very much for your kind words!
Sure, make sure that no post types are selected for search, and on the media search panel set to search only the captions.
Ernest Marcinko
KeymasterI think you could hook into the asp_search_start event, which is fired when a search is triggered via ajax search pro.
Something like:
document.querySelectorAll(".asp_main_container").forEach(function(el){ el.addEventListener("asp_search_start", function(event) { document.querySelector("#featured_element").style.display = 'none'; }); });Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterHi,
This may not be possible this way I’m afraid. The data is not shared on purpose, because each instance can have different filter setups and the initial values depend on both the query arguments as well as on the configuration. Different configurations require different data sent through the query arguments depending on the filter types.
Nevertheless, the ‘p_asid’ query argument determines which search ID the query arguments are referring to. With this code you can hook into that:
add_action('wp_footer', 'asp_custom_footer_script', 99999); function asp_custom_footer_script() { ?> <script> document.addEventListener("DOMContentLoaded", (event) => { WPD.Hooks.addFilter('asp_redirect_url', function(url){ return url.replace( "p_asid=1", "p_asid=2" ); }, 10); }); </script> <?php }This changes the redirection from search ID=1 to search ID=2 so all the query arguments are passed on. However this does not guarantee that they will work unfortunately.
Ernest Marcinko
KeymasterYou are welcome!
You could in theory try the auto-populate feature. Set it up like this. That will basically trigger an empty search which should yield the results with the prioritized items on top.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
-
AuthorPosts