First thing you should know is that a Search Page is a WordPress Page with a custom Page template to give users more information for searching your site.
There are different WordPress Themes, and they all feature different template files. Some of them include a search.php template file. This actually is not a Search Page, it is just a template which displays the search results. There is also a template file, and it’s called searchform.php. This is a template file which is often included in the sidebar of many themes and it generates the search box form. If you don’t have any in your theme, you can easily copy it from the Default theme.
In order to create your own custom Search Page, you will need to create a Page template to include your search form and the information you need your users to see before they search your site.
Check your WordPress Theme and see if it includes a page.php template file. The Default WordPress Theme includes this template, but many don’t. If it does, follow these instructions. If it doesn’t, we’ll provide you with the information you need to create your own.
Open the php, using a text editor, and save as searchpage.php
After saving it, edit the file:
- Delete The Loop, leaving the div tags intact.
- Add a heading like this “Search Posts” or something alike. You may use an existing class from your CSS style sheet, or create a new one.
- Copy this into the content div or any other div that contains the content of your Page: <?php get_search_form(); ?>
- At the top of your php, before anything else, add this to give your Search Page a heading WordPress will recognize in the Administration Panels: <?php
Template Name: Search Page
- Save the file
- Upload the file to your theme directory .
You can customize the display of your Search page. Go to the Manage > Pages panel, on your custom Search Page line, choose Edit. Or just open your searchpage.php in a text editor and edit it there.
Above the include function for your searchform.php within the content div, you may add text to help visitors search your site.
My Site features articles about
<a title=”WordPress Articles” href=”/category/wordpress/”>WordPress</a>,
<a title=”Web Design Articles” href=”/category/web-design/”>web page design</a>,
<a title=”Development Articles” href=”/category/website-development/”>website development</a>,
and <a title=”CSS Articles” href=”/category/css/”>CSS</a>.
<p>To search my website, please use the form below.</p>
<?php get_search_form(); ?>
You can include a list of keywords or other information, images, or details to customize your custom Search Page.
Hope this article helped you, guys!