Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search Results Page
This topic contains 8 replies, has 2 voices, and was last updated by Ernest Marcinko 4 years, 7 months ago.
- AuthorPosts
- October 26, 2018 at 2:29 pm #19638
I want to replace the default search results with ASP. The search form works fine and delivers page suggestions. When you click on the More Results button, it takes you to the results page but shows results from the WP internal search engine.
I read the documentation for customizing the results, and it says the page will have access to $r and $s_options in PHP. But the GET call only adds the following data to the URL (“outcome” is the entered search term): s=outcome&asp_active=1&p_asid=1&p_asp_data=Y3VycmVudF9wYWdlX2lkPTkmcXRyYW5zbGF0ZV9sYW5nPTAmYXNwX2dlbiU1QiU1RD10aXRsZSZhc3BfZ2VuJTVCJTVEPWNvbnRlbnQmYXNwX2dlbiU1QiU1RD1leGNlcnB0JmN1c3RvbXNldCU1QiU1RD1yZXNvdXJjZSZjdXN0b21zZXQlNUIlNUQ9cG9zdCZjdXN0b21zZXQlNUIlNUQ9bGVhZGVyc2hpcCZjdXN0b21zZXQlNUIlNUQ9bmV3c3JlbGVhc2UmY3VzdG9tc2V0JTVCJTVEPWJsb2dwb3N0.
Our current search page has been modified from the basic WP search template. I have attached the search.php file we are using.
How are the $r and $s_options being passed to the results page? In other words, how do I access these variables to use them in my template?
October 26, 2018 at 2:31 pm #19639Here is the search.php in zip format.
Attachments:
You must be logged in to view attached files.October 29, 2018 at 8:56 pm #19686Hi!
I’m very sorry about the delay, I missed your ticket by accident.
The results page usually does not contain those variables, as the results page handler opens a new output buffer, where these get reset/unset. However it is possible to obtain the options via the$_GET[‘p_asp_data’] variable, that is passed through the request, with this custom code:
After this the $s_options should contain the options from the form.
The $r variable is basically each result passed to the results page, in this case it’s equivalent is the $post within the results loop.
If you want to access which results the plugin passed to the reqults page, you can do it by accessing the query on the beginning of the file (before any query changes), like so:Then the $results variable should contain the results passed to this page.
Please note, that this sort-of qualifies as a modification request, so I cannot guarantee that my suggestions will work in all cases. I still try my best to help you out though.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 29, 2018 at 8:58 pm #19687Thanks. I’ll give this a try and let you know how it works out.
October 30, 2018 at 5:09 pm #19696This worked beautifully. The query results didn’t contain the description because we are using Advanced Custom Fields, but I was able to retrieve that information using the asp_id from the object the query returned.
October 30, 2018 at 5:35 pm #19697You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 30, 2018 at 5:37 pm #19698Give me time to send one more reply in a few hours. I have something I want to send as a thank-you.
October 30, 2018 at 6:22 pm #19699You cannot access this content.October 30, 2018 at 7:09 pm #19701You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.