0

I want to ask a question, and know if you can help me with some example or a function that allows me to do the following.

I have an API made on another platform, I want to show what's in that api in wordpress, as follows.

A page of wordpress, should contain a form, with several inputs, when you click in SEARCH NOW, must show the results in another page (which was consulted to the api extenal), when clicking on a result, you must take to another page where show the details of that query.

I can do all the queries, but I do not know how to make the results show, because wordpress needs to create each page

pages created in wordpress ( search, search_results, details)

1 Answer 1

1

WordPress itself can communicate with external API's through wp_remote_get and wp_remote_post. See the codex.

In your case, you could create a page template called page-search.php (keep in mind that search.php is reserved for the internal WordPress search functionality, so you would define it as a template, and select it when creating the page), and run your wp_remote_get code in that template.

There are of course other ways of doing it, like utilizing Javascript, with or without any of its available libraries.

The fetch API makes it quite easy to do it with Javascript.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.