So I guess the question is : How do I define new page/url to which I can pass custom parameters, do a search for custom post type and pass the results to custom template for rendering?
I have made a custom post type Apartment
. Apartments have occupied dates recorded in the database and I want users to be able to search for free apartments between two dates.
I know how to do the search algorithm but I don't know what is the best way to define a new search page with custom parameters in WordPress.
And I'd also like to avoid writing the search algorithm in the template file if possible.
URL should look something like this:
mysite.com/find/begin-date/end-date
- concrete example :
mysite.com/find/2018-03-05/2018-03-10
But it is also OK if it looks something like this as well:
mysite.com/find?begin=2018-03-05&end=2018-03-10