WordPress has a built-in search feature, and the search results usually contain posts and pages. These results are similar to the archive page, with searched text on the top. By default, this path is handled by the index.php file. However, there can be scenarios where the search results page needs to differ from the normal archive page. The need for highlighting search tem in content, are some of the instances where we need a separate design. In such scenarios, we can use the search.php file, which includes the same content as the index.php file, and modify it according to the client's custom requirements.
In this section, we had an extensive walkthrough of the complete WordPress theme template hierarchy. ...