Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › result page
- This topic has 6 replies, 2 voices, and was last updated 3 years, 1 month ago by
Ernest Marcinko.
-
AuthorPosts
-
September 25, 2022 at 3:58 am #39466
YUANFAN
ParticipantHow to make the result page appear in the iframe instead of jumping?
I can’t find the code location.-
This topic was modified 3 years, 8 months ago by
YUANFAN.
October 3, 2022 at 11:52 am #39479Ernest Marcinko
KeymasterHi,
I am not sure if this is possible at all. The form had to be submitted to the iframe, but the iframe source also has to be the original page.
I don’t think this is easily possible without maybe editing the core plugin files.October 3, 2022 at 10:22 pm #39489YUANFAN
ParticipantI uploaded a picture
My iframe is just below the search and I want the result page to appear in the iframeThe settings of the plugin Results Behaviour cannot be implemented, there is only an option to open a new window.
Because I’m not good at coding and don’t know where to start.
October 4, 2022 at 8:31 pm #39512YUANFAN
ParticipantHow to code the way to open the jump result page?
I don’t see _blank, where else can I modify it?October 5, 2022 at 8:47 am #39513Ernest Marcinko
KeymasterPlease note that custom coding is not actually part of our support. I will try to answer your questions, but I can’t promise anything regarding custom code.
The redirection to the results page (when assigned to a new window) is handled by a function. Maybe if you try to override that, it may actually work:
add_action('wp_footer', 'asp_add_footer_script_2', 9999); function asp_add_footer_script_2() { ?> <script> (function($){ WPD.ajaxsearchpro.helpers.openInNewTab = function(url) { Object.assign(document.createElement('a'), { target: 'iframe1', href: url}).click(); } }(WPD.dom)) </script> <?php }For this you also have to change the redirection to a new tab: https://i.imgur.com/KrUwaGP.png
However this may not work at all.
April 9, 2023 at 8:21 pm #42156YUANFAN
ParticipantYour code solved my problem. But after I updated ajax search pro version 4.26.2, the code became invalid. What causes it?
April 10, 2023 at 4:07 pm #42164Ernest Marcinko
KeymasterCheck if your frame name has not been changed, in the code it’s “iframe1”. There was no change in the scripts for the most recent releases, so this should still work just fine.
Also, you can try a different variation:
add_action('wp_footer', 'asp_add_footer_script_2', 9999); function asp_add_footer_script_2() { ?> <script> setTimeout(function(){ WPD.ajaxsearchpro.helpers.openInNewTab = function(url) { Object.assign(document.createElement('a'), { target: 'iframe1', href: url}).click(); } }, 2000); </script> <?php } -
This topic was modified 3 years, 8 months ago by
-
AuthorPosts
- The topic ‘result page’ is closed to new replies.