I am building a custom search form which has multiple search boxes and I rename them to “searchbox1” from “s”. Now WP does not use search.php; instead the code is execured from index.php. How can I make it to use search.php?
Leave a Reply
You must be logged in to post a comment.
Well, the
s
is not just a name/ID, it’s a query var, as the form’s fields are injected by means of GET or POST to the URL which is then checked for thes
query var.If the
s
query var is defined, thesearch.php
(if present in your theme) will then be called automatically.It’s okay if you have multiple searchboxes having fields that share the same name. Each searchbox has its own form anyway.
In short: rename the search’s input field back to
s
(or tweak the redirects/rewrites etc. which is nonsense, in my opinion).I think @tfâs suggestion is good. You should try to keep the name
s
. If you cannot do that you can filtertemplate_include
and return the template you want to use.Idea, not tested: