Generate Static Page to Show Search Results/Detail for API

I’m fairly new to WordPress, but well seasoned in PHP. I’ve looked around for other examples, and most of the code samples I see are all about creating posts and hooking around the search results list to customise the display.

What I have is a web form in WordPress that I intercept and pass the query to an external API and get a list of results back. I don’t want to use an IFRAME.

Currently at the moment, what I have is a form that gets shown when a short code is specified on a page, but when someone clicks the search button, the form action is blank so it goes back to the same page, and if it detects that the “button” is in the post back vars, it gets the results from the API and displays them. If the button isn’t there it displays the form.

But there’s two things from that. I need a dedicated results page. The search form could appear anywhere and formatted in any way, it may be horizontal, across the page, vertical in a side bar, or just big and bold in the main body.

On top of this, I need to be able to click on one of the entries in the results to be able to drill down deeper into specific information.

What is the best way of achieving this? Being PHP minded, Im thinking somehow programmatically registering two URL’s or Pages that I can set my form action to. Or as has just come to me, whether what I need to do, is to create two new dynamic pages with two new short codes such as “short_code_result_list” and “short_code_result_detail”, register those short codes and then call the functions in the usual way checking for the appropriate GET/POST variables, taking the appropriate action as we’re doing already to generate the list and referring the user back to the previous page if those variables are not set.

How would you achieve this?

Read more here:: Generate Static Page to Show Search Results/Detail for API

Leave a Reply

Your email address will not be published. Required fields are marked *