I’m sorry for this scholar question, but I’m totaly confused with search in WordPress. What is the difference beetwen searchpage.php
, searchform.php
and search.php
? Could anybody tell me how it all works? Thanks.
Leave a Reply
You must be logged in to post a comment.
Your question is most likely referring to a specific theme, but I’ll answer it for the current default Twenty Ten (WordPress Theme) as it’s well documented. You find it in the
wp-content/themes/twentyten
directory.The main search template in there is
search.php
. It is the template file to display the search page. Which means either only the search form or when called for a search, the search results as well.searchform.php
is a template part, so a fragment to hold the search form. The default theme does not ship with it by default, but if it exists it will load it instead of a hardcoded search form. Here is the default search from:That is done in the wordpress function
get_search_form()
which is part of the core package and used by many themes including Twenty Ten.searchpage.php
is something specific to another theme I guess, as it is not used within the default theme and worpdress core. I assume by name, that it’s having the same or a similar meaning assearch.php
but being specific to some other theme.searchpage.php is a custom page that usually includes searchform.php.
It offers functionality for the end-user to enter search criteria and press submit button.
The results appear in search.php.