WordPress Theme Development 8 - Search Form

There is a new template tag for search form, get_search_form();, in WordPress version 2.7.

However, the template tag will look for search form, searchform.php, first. If the file does exists, it will use that file. If not, it will generate the HTML. We decided to use this new template tag. Hence, we will replace the code as following in sidebar file, sidebar.php.

Now, new search code in sidebar file, sidebar.php, will look as following.

After using the new search template tag in sidebar file, sidebar.php, we move the old search code to a search form file called searchform.php. There is a example of search form file as following.

Related Posts

References

Comments

Comments powered by Disqus